Exemple #1
0
        public void Update(Vector2 MouseDelta)
        {
            const float MouseScale = 1.0f / 5f;

            if (MouseMovement && (MouseDelta.X != 0 || MouseDelta.Y != 0))
            {
                Yaw   -= MouseDelta.X * MouseScale;
                Pitch -= MouseDelta.Y * MouseScale;

                Pitch = Pitch.Clamp(-90, 90);

                //Matrix4x4 Rot = Matrix4x4.CreateRotationX(-MouseDelta.Y * MouseScale) * Matrix4x4.CreateRotationY(-MouseDelta.X * MouseScale);
                Rotation = Quaternion.CreateFromYawPitchRoll(Yaw * (float)Math.PI / 180, Pitch * (float)Math.PI / 180, 0);
                // TODO: Take into account the camera up normal
            }
        }