Rotating mesh around Y axis with pointer lock, help needed

Hey guys!

I am in need of a little help. In my project I am working on, I am currently rotating my player based on picking mouse cursor location, and then rotating the player towards it (think 3rd person camera, but the camera is higher a further, not behind the shoulder). It’s working fine and I had it like that for a long time, but I want to experiment with something different.

I have a task for anyone that would be interested.

Here is a simple playground with a box and a ground: https://www.babylonjs-playground.com/#TAZ2CB#59

What I want to accomplish is to rotate the box right if mouse moves right and left if it moves left, with pointer locked, while always keeping the camera behind the back face (always looking at the boxs’ butt :slight_smile: )

If anyone can help me accomplish this, I will be able to finally share the project I’ve been working on for the past 5 and half months. I know this community is amazing and full of very smart people so I have no doubt this is a piece of cake for someone out there!

Thanks a lot in advance!

I actually figured it out :man_facepalming:

1 Like