Vector2 CursorMoveDelta { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The CursorMoveDelta property provides the change in the cursor's position between the current frame and the previous frame, measured in screen space. This property is useful for detecting and responding to cursor movement in applications that require precise input handling, such as in-game editors or custom UI components.

Usage

Use the CursorMoveDelta property to track how much the cursor has moved since the last frame. This can be particularly useful for implementing features like drag-and-drop, custom cursor-based interactions, or for adjusting camera angles based on cursor movement.

Example

// Example of using CursorMoveDelta to adjust an object's position
Vector2 cursorDelta = Gizmo.CursorMoveDelta;

// Assuming you have a method to move an object based on cursor movement
MoveObjectBasedOnCursor(cursorDelta);

void MoveObjectBasedOnCursor(Vector2 delta)
{
    // Logic to move an object based on the cursor's movement delta
    // For example, moving an object in a 2D space
    objectPosition += new Vector3(delta.x, delta.y, 0);
}