Function gvr_sys::gvr_controller_state_get_gyro [] [src]

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

Returns the current controller gyro reading, in Start Space.

The gyro measures the controller's angular speed in radians per second. Note that this is an angular speed, so it reflects how fast the controller's orientation is changing with time. In particular, if the controller is not being rotated, the angular speed will be zero on all axes, regardless of the current pose.

The axes are in the controller's device space. Specifically:

  • The X axis points to the right of the controller.
  • The Y axis points upwards perpendicular to the top surface of the controller.
  • The Z axis points backwards along the body of the controller, towards its rear, where the charging port is.

As usual in a right-handed coordinate system, the sign of the angular velocity is given by the right-hand rule. So, for example:

  • If the controller is flat on a table top spinning counter-clockwise as seen from above, you will read a positive angular velocity about the Y axis. Clockwise would be negative.
  • If the controller is initially pointing forward and lying flat and is then gradually angled up so that its tip points towards the sky, it will report a positive angular velocity about the X axis during that motion. Likewise, angling it down will report a negative angular velocity about the X axis.
  • If the controller is banked (rolled) to the right, this will report a negative angular velocity about the Z axis during the motion (remember the Z axis points backwards along the controller). Banking to the left will report a positive angular velocity about the Z axis.

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