Description
The MouseDelta
property provides the movement delta from the mouse. This is a static property of type Vector2
and is part of the Sandbox.Input
class. It represents the change in mouse position since the last frame, which can be used to detect mouse movement in both the X and Y directions.
Usage
Use the MouseDelta
property to track how much the mouse has moved between frames. This can be useful for implementing features such as camera rotation or object manipulation in a game environment.
Since MouseDelta
is a static property, you can access it directly through the Input
class without needing to instantiate an object.
Example
// Example of using MouseDelta to rotate a camera
Vector2 mouseMovement = Input.MouseDelta;
// Assuming you have a camera object with a Rotate method
camera.Rotate(mouseMovement.x, mouseMovement.y);