How to Auto-Orient along path with a 3d Layer - Expressions
- May 18, 2025
- 1 reply
- 460 views
I am trying to get a shape layer to orient along the path but i need to use expressions (i need it for a setting in stardust) .
I can get it working if the path rotates in only 1 direction using these expressions on either the x, y or z rotation)
delayT = framesToTime(effect("Orientation Delay")("Slider")); // seconds
// Pilfered from dan Ebberts - https://www.motionscript.com/design-guide/auto-orient-y-only.html
p1 = thisComp.layer("Spin Controls")
.toWorld(thisComp.layer("Emitter Light").transform.position, time);
p2 = thisComp.layer("Spin Controls")
.toWorld(thisComp.layer("Emitter Light").transform.position,
time + delayT);
delta = p2 - p1;
// comment out the orientation required
xOrient = radiansToDegrees(Math.atan2(delta[2],delta[1])) + value;
// yOrient = radiansToDegrees(Math.atan2(delta[0],delta[2])) + value;
// zOrient = radiansToDegrees(Math.atan2(delta[1],delta[0])) + value;
However once i want to add say rotations in s axis the expressions breaksdown and behave strangely.
Does anyone have expressions where we can orient to the path? that works where all 3 axis work together?
I've included a demonstration project using shape layer to show the problem. My expressions are on the purple shape layer and i have a pink shape layer that is parented and has "auto-orient" along path turned on.

notice the purple layers weird flips and flutters
The world space transforms/vectors with the trig are just beyond me. help would be very appreciated

