PDA

View Full Version : tracking Y pos of locator


Snuurtje
06-10-2009, 03:49 PM
Hi, i got a scene that includes a gear thats rotating, next to it is a spring witch i want the Yscale to increase and decrease as the wheel turns. I thought i could achieve this by parenting a locator to my gear, witch rotates along, and then track the Yposition of that locator, and trough an expression let that set the scale of my spring.

Here is the expression code i got so far:

$scale = biggear1|biggearlocator1.translateY;
spring2.scaleY = $scale;

My idea was that the translation of the locator in the Y axis would go from say 0 to 10 and back to 0. But theres noowhere an attribute that tracks this.

Can anyone help me with this?


Got a screenshot for a bit of clarification maybe: http://snuur.nl/files/springgear.jpg
greetings

tbaypaul
06-10-2009, 05:00 PM
when you parent the locator to the wheel it's transform space is constant even though it is moving along with the wheel (the wheel does the work, the locator is just along for the ride)....point constrain another locator to that first locator and then use the constrained locator's y value in the expression.

tdHendrix
06-10-2009, 07:07 PM
Since the locator is parented under the gear its values will be the local values of the locator relative to its parent rather than the world space values. So when you rotate the gear I guess you could say that the locator isn't really moving and it's just coming along for the ride since it's parented to the gear. To fix it you will need to parent constrain (Constrain->Parent) the locator to the gear instead. That way its translation values will be the world values and it will still come along for the ride when the gear rotates.

CGTalk Moderation
06-10-2009, 07:07 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.