ups I may have talk to fast…
It works perfect for the example i posted but in my real project I’m tracking the position of a child object and when I tried to adapt the code I got an error caused for an infinite loop.
I also tried:
while ((P[2]>800)&&(P[2]>900))
but it didnt work…
Any idea to solve this?
* I will explain the scene: I got a group of objects (trees houses…) as child of a road (solid 90º rotation) which moves back into the horizon. When I reach the horizon ( z position= 800) I want the objects move down to be hidden into the ground.
Thank you all for your time
L=thisLayer;
P=L.toWorld(L.anchorPoint); //position of the child P[0] x, P[1] y, P[2] z
v=30; //velocity
if (P[2]>800) {
t = time;
while (P[2]>800) {
t-=thisComp.frameDuration;
}
transform.zPosition.valueAtTime(time-t)*v; // the z.position is actually y position because the parent has 90º rotation...
} else {
transform.zPosition;
}