How to make camera move and rotate to face a plane or cube in sequence

Hi guys,

Does anyone know how to animate a camera to move and rotate to a position or mesh.position and face the mesh?
I have tried a couple of things but am unable to achieve the desired effect.

Check out the playground link below and please note that the lines below are required as I need to restrict mouse interactions.

camera.lowerRadiusLimit = 20;
camera.upperRadiusLimit = 20;

https://www.babylonjs-playground.com/#WTJD0Z#24

Hi VoxelCubes,

I believe the ShowroomCamera discussed in the recent Babylon Utilities dev story does something that sounds like what you’re going for. You can see the Showroom Camera utility in action in its own demo as well as in Vaporwear demo site, where it is the camera for the entire experience. In your scenario, can you take NPM dependencies? If so, you should be able to just use that Babylon Utility directly. If not, I can help you dive into the implementation in case there are parts of it you can use. Hope this helps, and best of luck!

Hi @syntheticmagus,

Apologies for the late reply and thanks for pointing me in the right direction. :slight_smile: I will give this a go and keep you posted, looks like this camera is going to do the trick! :slight_smile:

Hello @VoxelCubes just checking in, was your question answered? Would you like some more help? :smiley:

Hi @carolhmj Thanks for checking in, yeah, my question was answered but I haven’t yet played with the code suggested in the last post as something else came up. I will keep you posted once I do, many thanks.

1 Like