MotionManager - Hizuvi/hizuvi.github.io GitHub Wiki

MotionManager

Purpose:

Getting input in an easy way.

Information:

Takes input from the device and converts it to rotation and movement. The rotation is how much the device is rotated. On a mobile device this is the tilt, left to right, and on computers this is the mouse's x position. The movement is the acceleration converted to one direction. On computers this the y movement of the mouse. Movement should be smoothed to avoid jitter and small movement from the users hands. This also helps people with disabilities to a certain degree.

Usage:

const motionManager = new MotionManager();

const rotation = motionManager.rotation; //How rotated the device is 
const movement = motionManager.movement; //How much the device moved