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.
Input
Name | Data Type | Description |
---|---|---|
Detection Frequency | Number | The number of detections performed per second |
Output
Name | Data Type | Description |
---|---|---|
On Successful | Exec | Executes when data retrieval is successful |
On Failed | Exec | Executes when data retrieval fails |
Gyroscope | Vec3 | Measures the angular velocity (rate of rotation) around the device's x, y, and z axes, with units in radians per second |
Accelerometer Vec3 | Texture | Measures the total acceleration applied to the device on its x, y, and z axes, including gravity, in meters per second squared (m/s²) |
Gravity Components | Vec3 | Measures 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 Angles | Vec3 | Represents 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 Type | Description | Rate of Change or Fixed Value | Usage Scenario |
---|---|---|---|
Gyroscope | Captures angular velocity, reflecting rotation speed around the device's axes 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 change | Sensitive interaction scenarios, such as motion games |
Acceleration | Measures the rate of change in velocity, suitable for detecting sudden movements or impact Detects the acceleration of the device on the X, Y, and Z axes | Rate of change | Shake-based games: trigger events when acceleration changes exceed thresholds |
Gravity Component | The gravitational force components along the x, y, and z axes, measured in m/s². Provides steady, absolute values for smooth controls | Fixed value | Racing games: control left/right movement using x/y gravity values |
Euler Angles | Provides rotation angles around the x, y, and z axes, offering absolute device orientation relative to a fixed frame of reference | Fixed value | First-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
Aim by moving the device up and down: monitor acceleration and gravity components to control aiming mechanics based on device motion
Racing game controls: utilize gravity components along the x and y axes for smooth left and right steering in racing games