Motion Sensor Overview
webOS TV Motion Sensor API provides cursor outputs and different types of motion data. The previous magic remote API partially supported the motion sensor feature, but the new and upgraded Motion Sensor API provides a better ease of use in implementing the features. Also, the scope of sensor parameters has been extended (for example, parameter, uncalibrated sensor data, gravity, and motion detector), and up to twenty clients can be handled.
See Magic Remote API Reference for details of the Motion Sensor API.
These are the supported sensor types.
TYPE_COORDINATE
TYPE_ACCELEROMETER
TYPE_ACCELEROMETER_UNCALIBRATED
TYPE_GRAVITY
TYPE_GYROSCOPE
TYPE_GYROSCOPE_UNCALIBRATED
TYPE_LINEAR_ACCELERATION
TYPE_GAME_ROTATION_VECTOR
TYPE_SIGNIFICANT_MOTION
TYPE_STEP_COUNTER
TYPE_STEP_DETECTOR
Motion Sensor is supported on webOS TV 24.
Use Cases
Various game apps can be implemented using the webOS TV Motion Sensor API.
Golf
When a player swings a golf club, the strength of the hit to the ball is related to the acceleration and direction, with the orientation, of the club. The length of the club and the direction where it is heading also need to be taken into account to calculate the exact point of hitting on the club head. These match the components of the game rotation vector's quaternion for scale and vector.
Racing
Games that require steering or piloting of a vehicle or object, such as Mario Kart or Wave Runner, can utilize the tilt of the controller to determine the direction of motion. Tilt can be calculated from the calibrated accelerometer output.
webOS TV Motion Sensor API provides an example of the use of the HexGL Game Application. To learn more, check out the HexGL sample app.
Tennis
Tennis games use the similar principles to golf games. The strength of the hit is related to the acceleration and direction, with the orientation, of the racket. In a more complex tennis game, the game engine further needs to translate this information into a digital racket to determine which part of the racket hits the ball and calculate its spin. These match the components of the game rotation vector's quaternion for scale and vector.
Bowling
Simple bowling games can use the same principles as the golf and tennis games. For example, if a user holds a button to swing the ball and then releases the button to drop the ball, the game rotation vector at this point of the release can determine the trajectory of the ball. Additionally, by keeping a brief history of the motion, the game engine can add spin to the ball’s motion.
Fitness and Dance
Fitness games direct users to move in a certain way that matches what is on the screen. For a given song or fitness routine, games have a library of expected motions, and without a camera, it is difficult to determine exact arm motions of a user. However, as the user tries to move in match with what they see on the screen, a motion sensor outputs vector and scale information and checks how much the user’s movement matches the motions defined in the library. Due to the fast and precise nature of these games, what is required is only the orientation data at the end of each move. There is no need for buttons here except for traversing menu options. Looking into the acceleration in different directions (up, down, and sideways) helps determine the user-frame acceleration, making the system more robust. Integrating this user-frame acceleration gives a user-frame velocity which can also be used to verify the fitness/dance moves, though it is recommended only for short periods of time due to possible integration errors.