InputMotionData MotionData { get; set; }

robot_2Generated
code_blocksInput

Description

The MotionData property provides the current state of the motion sensors of the input device, if supported. This property is static and can be accessed without instantiating the Input class. It is particularly useful for games or applications that require motion-based input, such as tilting or rotating the device.

This feature is supported on the following devices:

  • Dualshock 4+
  • Switch Controllers
  • Steam Controller
  • Steam Deck

Usage

To access the motion data of a supported input device, simply use the MotionData property from the Input class. This will return an instance of InputMotionData, which contains the relevant motion sensor data.

Example usage:

var motionData = Input.MotionData;
if (motionData != null)
{
    // Use motionData to access specific sensor values
    var acceleration = motionData.Acceleration;
    var rotationRate = motionData.RotationRate;
    // Process the motion data as needed
}

Example

var motionData = Input.MotionData;
if (motionData != null)
{
    // Use motionData to access specific sensor values
    var acceleration = motionData.Acceleration;
    var rotationRate = motionData.RotationRate;
    // Process the motion data as needed
}