Skip to main content

Sensor Data

The Sensor Data node can acquire and process gyroscope data from a gyroscope sensor. A gyroscope measures angular velocity, or the rate of rotation around the device's axes, and is key to detecting movements such as tilting, turning, or shaking.

By combining gyroscope data with other algorithms, this node outputs additional motion-related information, including acceleration, gravity vectors, and Euler angles. This data enables you to track device motion and orientation, facilitating the creation of engaging interactive games and applications.

user ranking node

Input

NameData TypeDescription
Detection FrequencyNumberThe number of detections performed per second

Output

NameData TypeDescription
On SuccessfulExecExecutes when data retrieval is successful
On FailedExecExecutes when data retrieval fails
GyroscopeVec3Measures the angular velocity (rate of rotation) around the device's x, y, and z axes, with units in radians per second
Accelerometer Vec3TextureMeasures the total acceleration applied to the device on its x, y, and z axes, including gravity, in meters per second squared (m/s²)
Gravity ComponentsVec3Measures the gravitational force applied to the device on its x, y, and z axes, excluding other forces, in meters per second squared (m/s²)
Euler AnglesVec3Represents the device's orientation using pitch (x-axis rotation), yaw (y-axis rotation), and roll (z-axis rotation), typically measured in degrees

How the Sensor Data Node Works

The Sensor Data node processes various forms of motion data to enable interaction with mobile devices in real-time scenarios. Below are key details:

  • Acceleration vs. gravity: At rest, acceleration values align with gravity. During rapid motion, the two diverge, offering distinct metrics for movement.
  • Gyroscope: Angular velocity is measured to track rotational movement. In a stationary state, gyroscope readings remain near zero, making it effective for detecting shaking or rotational changes.
  • Euler angles: Represents the 360° rotational changes, simulating the full posture of a mobile device and making orientation tracking highly accessible
  • Rate of change sensitivity: Use gyroscope and accelerometer data for scenarios requiring quick responsiveness.
  • Shake detection: Combine acceleration and gyroscope readings for precise event triggering during shaking
  • Simplified control: Gravity components offer straightforward and smooth control mechanics, ideal for racing or tilting-based games.

This combination of features makes the Sensor Data node versatile for real-time interactive applications.

Sensor Data Types

The Sensor Data node outputs four distinct data types, each suited for specific use cases:

Data TypeDescriptionRate of Change or Fixed ValueUsage Scenario
GyroscopeCaptures angular velocity, reflecting rotation speed around the device's axes

gyroscope model

Measures the rate of rotation along a specific coordinate axis. In use, the rotor of the gyroscope always points in a fixed direction when rotating at high speed. When the direction of movement of the moving object deviates from the predetermined direction, the gyroscope can feel it.

Rate of changeSensitive interaction scenarios, such as motion games
AccelerationMeasures the rate of change in velocity, suitable for detecting sudden movements or impact

acceleration model

Detects the acceleration of the device on the X, Y, and Z axes

Rate of changeShake-based games: trigger events when acceleration changes exceed thresholds
Gravity ComponentThe gravitational force components along the x, y, and z axes, measured in m/s². Provides steady, absolute values for smooth controlsFixed valueRacing games: control left/right movement using x/y gravity values
Euler AnglesProvides rotation angles around the x, y, and z axes, offering absolute device orientation relative to a fixed frame of reference

acceleration model

Fixed valueFirst-person games: control camera perspective (yaw for horizontal, pitch for vertical)

Example Use Cases

The Sensor Data node allows you to leverage device action data to create engaging and interactive games. Below are practical use cases:

  • Control angles by moving the device: use Euler angles to track the phone's orientation, enabling intuitive tilt-based angle adjustments

    tilt game
  • Aim by moving the device up and down: monitor acceleration and gravity components to control aiming mechanics based on device motion

    aim game
  • Racing game controls: utilize gravity components along the x and y axes for smooth left and right steering in racing games

    racing game