Hello JGO,
I’m trying to implement quaternions for rotations, but I got stuck. When I try to rotate, the camera goes in random directions. I’m not very experienced with quaternions, so perhaps I’m making huge mistakes in it.
/**
* Add rotation (rx, ry, rz) to the camera
*/
public void addRotation(float rx, float ry, float rz) {
Quaternion.mul(new Quaternion(1f, 0f, 0f, (float) (ry * PI_OVER_180)), rotation, rotation);
rotation.normalise();
Quaternion.mul(new Quaternion(0f, 1f, 0f, (float) (rx * PI_OVER_180)), rotation, rotation);
rotation.normalise();
Quaternion.mul(new Quaternion(0f, 0f, 1f, (float) (rz * PI_OVER_180)), rotation, rotation);
rotation.normalise();
}
Does anyone have experience with quaternions or knows some helpful resources, because I can’t find the answer?