Function gvr_sys::gvr_controller_state_get_accel [] [src]

pub unsafe extern "C" fn gvr_controller_state_get_accel(
    state: *const gvr_controller_state
) -> gvr_vec3f

Current (latest) controller accelerometer reading, in Start Space.

The accelerometer indicates the direction in which the controller feels an acceleration, including gravity. The reading is given in meters per second squared (m/s2). The axes are the same as for the gyro. To have an intuition for the signs used in the accelerometer, it is useful to imagine that, when at rest, the controller is being "pushed" by a force opposite to gravity. It is as if, by the equivalency princle, it were on a frame of reference that is accelerating in the opposite direction to gravity. For example:

  • If the controller is lying flat on a table top, it will read a positive acceleration of about 9.8 m/s2 along the Y axis, corresponding to the acceleration of gravity (as if the table were pushing the controller upwards at 9.8 m/s2 to counteract gravity).
  • If, in that situation, the controller is now accelerated upwards at 3.0 m/s2, then the reading will be 12.8 m/s2 along the Y axis, since the controller will now feel a stronger acceleration corresponding to the 9.8 m/s2 plus the upwards push of 3.0 m/s2.
  • If, the controller is accelerated downwards at 5.0 m/s2, then the reading will now be 4.8 m/s2 along the Y axis, since the controller will now feel a weaker acceleration (as the acceleration is giving in to gravity).
  • If you were to give in to gravity completely, letting the controller free fall towards the ground, it will read 0 on all axes, as there will be no force acting on the controller. (Please do not put your controller in a free-fall situation. This is just a theoretical example.)

@param state The controller state to get the accelerometer reading from. @return The accelerometer reading from the controller state.