FORUMS: list search recent posts

Parenting a box to two nulls at once.

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Mikkel Laurendz
Parenting a box to two nulls at once.
on Dec 4, 2017 at 12:15:01 pm

What i am trying to achive is a wagon with square wheels.

I have got the wheels moving and so on, but i need the "body" of the carrige to move with the wheels.

So the wheels are offset so that they roate opposite of eachother so the body of the wagon needs to rotate a little allso.

So, i need the two lower corners of a box to be "attatched" to the square wheels.

Kinda like the line is doing here.


Any help is appreciated!


Return to posts index

Walter Soyka
Re: Parenting a box to two nulls at once.
on Dec 4, 2017 at 5:55:14 pm

Let's create one null that can drive the carriage, based on the two points you have: the bouncing centers of each wheel. I'm going to assume you have one layer "Wheel 1" and a second layer "Wheel 2", and that the anchor point of each layer represents its center.

Here's an expression for the position of the midpoint of the line segment from Wheel 1's anchor point to Wheel 2's anchor point:
p1 = thisComp.layer("Wheel 1").toWorld(thisComp.layer("Wheel 1").transform.anchorPoint);
p2 = thisComp.layer("Wheel 2").toWorld(thisComp.layer("Wheel 2").transform.anchorPoint);
(p1 + p2) / 2;


And here's an expression for rotation of that midpoint to match the angle:
p1 = thisComp.layer("Wheel 1").toWorld(thisComp.layer("Wheel 1").transform.anchorPoint);
p2 = thisComp.layer("Wheel 2").toWorld(thisComp.layer("Wheel 2").transform.anchorPoint);
delta = p2 - p1;
angle = radiansToDegrees(Math.atan2(delta[1], delta[0])) % 360;


Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]