bool WasPressed { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The WasPressed property of the DigitalInput struct in the Sandbox.VR namespace indicates whether the digital input was pressed in the previous frame. It returns true if the input was pressed, and false if it was not.

Usage

Use the WasPressed property to determine the state of a digital input in the previous frame. This can be useful for detecting input transitions or changes over time, such as when an input is first pressed or released.

Example

// Example of using the WasPressed property
DigitalInput input = new DigitalInput();

// Check if the input was pressed in the previous frame
if (input.WasPressed)
{
    // Execute logic for when the input was previously pressed
    HandleInputPreviouslyPressed();
}

void HandleInputPreviouslyPressed()
{
    // Logic to handle the input being pressed in the previous frame
}