Arc Rotate Camera Animation - Target Animation Freezes Other Properties' Animations

I’m finding that animating the Target property on an Arc Rotate Camera at the same time as other properties, like Alpha, Beta and Radius, has some unexpected results. If the Target animation is first in the animations list, the camera behaves as I’d expect. But if the Target is last in the animations list, the other values stay frozen throughout. I know changing the Target affects the other three values, but I’d still expect the other values to be changing throughout the animation, and potentially be slightly off right at the end because the Target was set last and threw the other values off. But the non-target values staying frozen seems like it’s potentially a bug. See this playground for a simple example that’s only animating the Target and Alpha, you can see the two different behaviors depending on their order in the animations list: https://playground.babylonjs.com/#DMLMIP#88

It’s not a bug, it’s because setTarget recompute the radius, alpha and beta properties based on the parameter passed to it. So, whatever the values of those properties before the call, they will be overwritten by the call.

What you can try is:

  1. save the current values of radius, alpha and beta
  2. call setTarget => copy the radius, alpha and beta values
  3. reset the radius, alpha and beta properties to the ones saved at step 1
  4. use the values copied at step 2 as the end values of your radius / alpha / beta animations

Thanks for the response. In my playground, the goal is to animate the target and alpha properties to specific values I already know in advance. I want the target to be (0,0,0) and the alpha to be 1 (initially they are at (0, 1, 0) and pi/2, respectively). Following your instructions, when I copy the alpha value after setTarget() in step 2, it has been reset to pi/2, so obviously the subsequent animation won’t go to the alpha value I want it to, which is 1. Would you be able to go to my playground and try the two buttons and confirm that this is the expected behavior, ie, you get different two outcomes depending on the order of the animations in the array?

Yes, as explained above, setting the target of the Arc Rotate Camera will recompute the radius, alpha and beta properties, there’s no way around that => the current alpha value of the camera is not used in this computation, that’s why setting it before setting the target does nothing.

Got it, thank you.