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

11 November 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.

11 November 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 (

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

CGTalk Moderation
11 November 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.