Best camera for cinematics?

Hi there,

I need a simple camera for cinematics that I can programmatically control using 3 parameters:

  • setting the camera position
  • setting the camera target (or setting the direction vector)
  • setting the camera upVector

All 3 need to be animated (using scene.beginAnimation()).

So far, I can’t manage to have all 3.
For example using the ArcRotateCamera, I can’t set or animate the upVector. Using the FreeCamera, I can set anything, but I can’t figure out how to animate the target vector (camera.setTarget() works, but animating the camera.target property throws an exception).

Any suggestion?

That should work: can you create a repro in the Playground?

It’s seems to work better in Playground: here (v4.2.0-alpha31). But there is still a bug, the animation speed is wrong, it should last 2 seconds but it actually lasts some hundreds of ms. Changing both occurrences of ‘target’ into ‘position’ have the correct animation speed: playground.

On the contrary, it throws on the latest release existing on Npm (v4.1.0).

You need to clone the target when setting the value for frame 0, else it is reused for the computation:

https://www.babylonjs-playground.com/#SRZRWV#301

In 4.1, the getter target did not exist, you had to use getTarget().

1 Like

Thanks a lot, I get it to work now, using 4.2-alpha version.

I really appreciate the community here, very kind and reactive :wink: