[SOLVED] Camera Rotation on X Axis

image

I want to rotate the camera on the X axis, I just want to rotate the camera in one direction constantly.

I’ve tried many things and it ends up weird.
I don’t want the Z and Y axis altered at all.

Thanks,
Kevin

camera.setRotation(new Quaternion().fromAngles(pitchInRadians, 0, 0));

Edit: though note that from your picture, you and I may have very different ideas of what the x-axis is.

Edit 2: to put it another way, if your head were the camera, do you want to say yes, say no, or put your ear to your shoulder.

fromAngles(yes, no, accha)

…the last of which only makes sense if you’ve been around Hindi people who to the head tilt. :slight_smile:

Edit 2: Ear to shoulder, but in a complete circle.

Camera original rotation is (0,1,0,0)
camera.setRotation(new Quaternion().fromAngles(pitchInRadians, 0, 0));
Alters the view and y become 0 and the camera is not facing nodes anymore.

Camera faces z so you want to rotate around the z axis.

Note: if those are the quaternion values then you’ve done the equivalent of telling me “Existing rotation is four magic beans”.

new Quaternion().fromAngles(0, 0, radians);

If you want that relative to some other existing rotation then you will have to multiply it by that other rotation.

Thanks, that worked. It is spinning just right.

Kevin

1 Like