Camera fellows mesh that rotate locally

hello guys :raised_hand_with_fingers_splayed: :slightly_smiling_face:
i’m trying to have a camera that fellows a mesh in local rotation like a simple tpp game but i can’t
i tried to make the mesh a parent of the camera its not working , tried to change in alpha and beta props of the arc rotate camera but only rotating in global axis , and the other camera types won’t focus on a target , i’m stuck the whole day please help :cry:

How about this:

https://playground.babylonjs.com/#L74Z8G

This very simple example has a free camera. The parent of the camera is set to be the sphere. The sphere is rotating and the camera follows it according to the animating rotation.

The net visual isn’t super interesting, it basically just looks like the ground is spinning, but it’s actually the sphere that’s rotating and the camera is following it.

Does that all make sense?

Is that helpful?

3 Likes

what should i say :sweat_smile: you saved me . thank you so much .
i used setParent() method instead of .parent .so it shows “setParent() is not a function” i didn’t notice there is a difference .

.setParent() works for meshes but not cameras unfortunately. Sorry for the confusion.

1 Like

got it :+1: