-
2nd part of conditional statement not working
I’m trying to use the keyframes for position to drive other parameters, rotation in this case, but only for part of the position animation.
The first part, from kf1 to kf2 works fine, but when the object moves to kf3 it is also rotating, which I do not want.I added a part of the condition that states that if the kf is bigger than 2 then the value should be 0, but as I see the object moving from kf2 to kf3 I see the rotation parameter still following the linear expression instead of defaulting to 0 as I want it to happen.
Any help is greatly appreciated.
p=transform.position[0];
k1=transform.position.key(1).value[0];
k2=transform.position.key(2).value[0];
n = 0;
if (marker.numKeys > 0){
n = marker.nearestKey(time).index;
if (marker.key(n).time > time) n–};
if
(n<2)
{
x=linear(p,k1,k2,value,0);
}
if
(n>2)
{x=0}
x
;