Is there a way to animate arcRotateCamera by target and position?

Hey community,

Is there a way we can apply animation data to an ArcRotateCamera’s target and position directly by any chance?

For example, if I load in two sets of animation data from a .gltf, and I want to apply one set to “target” of the camera while apply another set to “position” of an camera? Also, I hope the camera type should be ArcRotateCamera since I need to control the radius of the camera after.

From the test I have so far, if I use for example scene.cameras[i].target = ..., I can update the camera dynamically right away which is great. But when I use scene.cameras[i].position = ..., the position won’t change dynamically until I call the rebuildAnglesAndRadius() function. But in this case I wont be able to animate the position in real-time. PS: I have also tried setPosition and setTarget and seems not working.

Any good solutions?

My PG:

Many thanks!

For target you can simply use something like:

const targetPosition = Vector3.Lerp(startPosition, endPosition, lerpAmount);
camera.setTarget(targetPosition, undefined, false, true);

For position, given it’s an arc rotate camera, you’re better off interpolating alpha, beta and radius, because together these properties determine position.


ArcRotateCamera is native to BabylonJS, your unreal camera is imported as FreeCamera.

After looking at the hierarchy of your scene, I noticed that you unreal camera is nested under some nodes and you’re animating the nodes rather than the camera object.


if you want to use ArcRotateCamera, you need to write some custom code to convert these animation to alpha, beta and radius
else you can use a FreeCamera, but you need to take the parenting into consideration in order to figure out the correct position and rotation values

Also, just saying, scaling the camera is a bad practice.

Good luck.

1 Like

Probably this thread may help - How to build animation for ArcRotateCamera so it can rotate smoothly


@MeshSlayer Thank you for the response!

ah you are right. the camera node itself doesnt contains animations while the higher level transform nodes have.

Is any way I can consolidate the nested transforms and bake the final result in one camera node?