Best way to move it move it?

Hello,

I am currently trying to create a movement system.

As I have seen there’re several ways on how to do this. One is using impulses: https://www.babylonjs-playground.com/#15AFCG#51

The thing is. If I add a camera on this box in the scene, it might not be great to have the box rotate, since the camera will follow. So how do I stop the rotation? What would be the best way to move? Essentially like in a first or third person game?

In the scene you can move using WASD.

moving the object and moving the camera would be two different aspects of your code.

For the camera , it is never parented to the object , rather it is common to have a “follow” script for the camera where you can specify a target. You will have to look into this more because at first it just a simple solution using look at and some easing. The complexity of a good camera follow solution is obviously more than that.

You need to possibly have a delayed orbit to get the camera behind the target after the target rotates etc. You have to start dealing with all the other edge case scenarios as well. Like when some object gets in the way between the camera and the target , how to handle spaces like wall corners or when the radius gets close to the target.

There is actually plenty of info out there regarding follow cams and games , much in the unity development sphere. I know personally of having seen a whole video series where some devs tackle these edge case problems ( I know it involved having to cast a ray backwards from the target to the camera )

1 Like

Hello @Myrmod just checking in, was your question answered?