Wait until rotateLocal transition is finished

Hey, I’ve been working with the Transition.rotateLocal function, and I noticed that it doesn’t allow multiple consecutive executions unless the previous one has fully completed.

The issue is that the function doesn’t return a Promise or provide any kind of callback or event to detect when the transition has finished. It just returns an object instance that doesn’t expose any useful method or state to track its completion.

The only solution I’ve found so far is to manually use Time.schedule with the same duration as the transition to delay the next call. However, this approach isn’t reliable, since it’s based on hardcoded timing rather than being linked to the actual end of the transition.

Is there a more robust or native way to wait for Transition.rotateLocal to complete before executing it again?

This is my code:

const camera = Scene.getItem("Camera");

camera.transition.rotateLocal(camera.transform.axisZ, Math.PI / 2, 2);
Time.schedule(() => {
    camera.transition.rotateLocal(camera.transform.axisZ, -Math.PI / 2, 2)
}, 2);


Hi @pablornc

Thanks for sharing your code!

Transition.rotateLocal returns Tweener instance. It uses the onFinish method. If you want to “promisify” this (e.g. to use with async/await), you can do the following:

new Promise(resolve => item.transition.rotateLocal(...).onFinish(resolve));

Hope this helps!