PDA

View Full Version : Rotation script set by tangent point at nearest spline


jonahhawk
11-22-2010, 07:48 PM
I am trying to set the z rotation of a point by the tangent of the nearest point on spline.

It works (though it translate the point??) in a script but I'm having trouble doing it in a controller with circular references etc.


Ln = $Line0001
Pt = $Point0001

Param = nearestPathParam Ln 1 Pt.pos
tangentBez = tangentBezier3D Ln 1 1 Param pathParam:false
theAngle = aCos (dot [1,0,0] tangentBez)
Pt.rotation = (EulerAngles 0 0 theAngle)



Eventually, I will create an average angle based from all of the sub splines in the given splineShape.

rafoarc
11-22-2010, 08:05 PM
for the circular dependency issues, what if you use assign controller instead of assign track (in a script controller, not expression...) take a look here (http://forums.cgsociety.org/showthread.php?f=98&t=933928)...

jonahhawk
11-22-2010, 09:18 PM
Ah! FacePalm. I knew that... At one point... Thanks for the reminder. Contoller.value

CGTalk Moderation
11-22-2010, 09:18 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.