Ray PreviousRay { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The PreviousRay property of the Gizmo class provides access to the ray that was used in the previous frame. This is useful for tracking changes in raycasting operations over time, such as when implementing interactive elements that respond to mouse or pointer movements.

Usage

Use the PreviousRay property to retrieve the ray from the previous frame. This can be particularly useful in scenarios where you need to compare the current ray with the previous one to detect changes or movements.

Example

// Example of using PreviousRay in a Gizmo context
Ray previousRay = Gizmo.PreviousRay;

// Use previousRay to compare with the current ray
Ray currentRay = Gizmo.CurrentRay;

if (previousRay != currentRay)
{
    // Handle ray change logic here
    // For example, update a visual indicator or perform a specific action
}