Hi guys, I have searched and searched for a solution to this problem, but nothing works
All I want, is for the camera to rotate about a point (this rotation is akin to how the girl from the exorcist twists her head }:-@ if you had to imagine the plane of rotation) of my choosing.
I want the camera to rotate a fraction when I press the right and left arrow buttons.
I tried this in my update method
if (KeyBindingManager.getKeyBindingManager().isValidCommand("right"))
{
roll180.fromAngleAxis( FastMath.PI/2 , new Vector3f(0,1,0) );
/* The rotation is applied: The object rolls by 180 degrees. */
cam.setAxes( roll180 );
}
but for whatever reason, that didnt work. The error is at the line "roll180.fromAngleAxis......);"
You should try to use the function cam.setLocalRotation(arg), and if i am not mistaken arg is a quaternion, in that you can use the function you wrote, fromangleaxis…
This might be a strange question, but did you initialized your roll180 object? If it is causing a NPE, then pehaps you should check (with an if perhaps?) if it is actually null before calling the fromAngleAxis method.
Also, you should be using Vector3f.UNIT_Y instead of creating a new Vector3f for it every time you call this.