-
Rotational velocity scripting woes
Hi! I’m trying to get the rotational velocity of an object that is auto-orienting to a path. The object is a top-down view of a bicycle, and I’m trying to link the front wheel rotation to the bike’s rotation. (Once I get the rotation worked out, I’ll work the speed of the bike into the equation too.) I can’t get the bold section to work. I don’t know if I’m putting it in the wrong place, or if I need different syntax for this situation. The original code that I’m modifying gets the rotation of an object that is auto-oriented. Any help anyone can give would be very VERY appreciated.
Mainly, I’m having the issue with getting the value of the object’s rotation a frame before, so I can determine how much the front wheel of the bike should be turned. Thanks so much, and here’s my code.
L = comp(“Final Animation”).layer(“cyclist1”);
u = L.toWorldVec([1,0]);
uOld = L.toWorldVec([1,0]).valueAtTime(time-1); // <==here's where I'm getting my error r1 = radiansToDegrees(Math.atan2(u[1],u[0])); r2 = radiansToDegrees(Math.atan2(uOld[1],uOld[0])); r1 - r2