headYaw = rawYawPitchRoll[0];
headPitch = rawYawPitchRoll[1];
headRoll = rawYawPitchRoll[2];
// Apply pitch offset
Quaternion pitchCorrection = new Quaternion();
Vector4f vecAxisPitchAngle = new Vector4f(1f, 0f, 0f, -lookPitchOffset * PIOVER180);
pitchCorrection.setFromAxisAngle(vecAxisPitchAngle);
Quaternion.mul(pitchCorrection, orientation, orientation);
// Apply yaw offset
Quaternion yawCorrection = new Quaternion();
Vector4f vecAxisYawAngle = new Vector4f(0f, 1f, 0f, (-lookYawOffset * PIOVER180));
yawCorrection.setFromAxisAngle(vecAxisYawAngle);
Quaternion.mul(yawCorrection, orientation, orientation);
// Get camera orientation:
// Matrix
cameraMatrix4f = QuaternionHelper.quatToMatrix4fFloatBuf(orientation);