Adobe After Effects Forum Constraint movement along X, Y and Z axis |

by Rowan de Geus on Jun 21, 2019 at 9:45:04 am

Hello reader,

I am struggling creating an expression to constrain movement of a layer to a certain angle. I found this isometric expression which works great:

pos = transform.position;

x = effect("X Movement")(1);

z = effect("Z Movement")(1);

y = effect("Y Movement")(1);

[x*Math.sqrt(3) + z*Math.sqrt(3) + pos[0], -x + z + y + pos[1]];

But how can I adjust this to match angles of 190 and 140?

EDIT: Found it for the X axis (thanks Dan):

x = effect("X Movement")("Slider");

a = 190;

y = -x*Math.tan(degreesToRadians(a));

value + [x,y]

But how to adjust this so Z has an angle of 140?

by Rowan de Geus on Jun 21, 2019 at 11:07:43 am

Got it:

pos = transform.position;

x = effect("X Movement")(1);

z = effect("Z Movement")(1);

y = effect("Y Movement")(1);

a1 = 190;

a2 = 40;

[x + z + pos[0], -x*Math.tan(degreesToRadians(a1)) + z*Math.tan(degreesToRadians(a2)) + y + pos[1]];

by Michael Szalapski on Jun 28, 2019 at 5:05:26 pm

Thank you for sharing your solution!

- The Great Szalam

(The 'Great' stands for 'Not So Great, in fact, Extremely Humble')

No trees were harmed in the creation of this message, but several thousand electrons were mildly inconvenienced.

© CreativeCOW.net