Make y rotation, update the objects x axis

I feel like I should know the answer to this, but somehow I just don’t.

I have a world.
I can move about in this world.

And when I press m, I can rotate the x axis.

Great.

I can then walk around using buttons wasdeq.

Using q and e. I can rotate to left and right.

Great.

But if I say, rotate to the right a bit.

Then i I want to move around with the mouse again, using the m button.

The x axis rotation is still the same as it was before I rotated the y axis.
I’m rotating the camera around the x axis of the whole world, apparently.
Not the x axis of the camera.

How can I update the system when I rotate the camera on the y axis.
So that the x axis becomes the x axis of the camera. Not the x axis of the whole world?

When I’m rotating on the y axis, I’m just doing:
object.renderer.rotation.y+=0.1;

The rotation order might be wrong for what you’re trying to do. Try YXZ instead.

1 Like