Description
The Delta
property of the DigitalInput
struct in the Sandbox.VR
namespace indicates the change in the input state since the last update. It returns a Boolean
value that is true
if the input state has changed, and false
otherwise. This property is useful for detecting transitions in input states, such as when a button is pressed or released.
Usage
Use the Delta
property to determine if the state of a digital input has changed since the last frame. This can be particularly useful in scenarios where you need to trigger actions based on input state changes, such as toggling a feature when a button is pressed or released.
Example
// Example of using the Delta property
DigitalInput input = new DigitalInput();
// Check if the input state has changed
if (input.Delta)
{
// Perform an action based on the change in input state
if (input.IsPressed)
{
// The input was just pressed
// Execute logic for when the input is pressed
}
else
{
// The input was just released
// Execute logic for when the input is released
}
}