rotate method
Rotates the camera's yaw and pitch.
Both yawDelta
and pitchDelta
are in radians.
Implementation
void rotate(double yawDelta, double pitchDelta) {
// Create quaternions for both yaw and pitch rotations.
final yawRotation = Quaternion.axisAngle(Vector3(0, 1, 0), yawDelta);
final pitchRotation = Quaternion.axisAngle(Vector3(1, 0, 0), pitchDelta);
// Multiply the yaw with the current and pitch rotation to get the new
// camera rotation.
rotation = (yawRotation * rotation * pitchRotation)..normalize();
}