Thanks for the code Dan!
The breaking part works very good, until the brake will be “released”, then the wheel rotation value goes back to the car’s position value.
I think, that now I need to track the car’s position to get the current x value and apply that when the checkbox is unchecked?
I added a few lines to the code, got no error’s but also no result:
need to use some other approach I think 🙂
tx = comp("Main").layer("Truck").transform.position;
n2 = tx.nearestKey(time).index;
if (time < tx.key(n2).time) n2--;
t2 = tx.key(n2).time;
cb = comp("Main").layer("CarControl").effect("Break On")("Checkbox");
if (cb.value == 0){
tx.valueAtTime(t2)[0];
}else{
n = cb.nearestKey(time).index;
if (time < cb.key(n).time) n--;
t = cb.key(n).time;
comp("Main").layer("Truck").transform.position.valueAtTime(t)[0];
}