GestureInterface

public class GestureInterface

This is the main class used for hand detection. It controls start/stop of the detection as well as result update.

Methods

public static int GetFrameIndex()

Returns the frame index, which can be used to indicate detection status. Negative means stopped or error, 0 means starting, positive means up and running.

Returns:Frame index. If frame index is not changed, values of GetLeft and GetRight remains the same.
public static GestureResult GetLeft()

Get left hand result. Only meaningful if GetFrameIndex returns positive value.

Do not modify the value of the return object.

Returns:Left hand result.
public static GestureResult GetRight()

Get right hand result. Only meaningful if GetFrameIndex returns positive value.

Do not modify the value of the return object.

Returns:Right hand result.
public static native void SetCameraTransform(Vector3 position, Quaternion rotation)

Set hmd transform for use. This function should be called regularly if HMD pose is changing. The transform is used until new one is set. Default transform is idendity.

Only takes effect if UseExternalTransform is called with value true before Start.

Parameters:
  • position – HMD position in Unity axis, null means origin point.
  • rotation – HMD rotation in Unity axis, null means idendity.
public static GestureFailure Start(GestureOption option)

Start detection with given option.

Parameters:
  • option – The option used to start detection. If option is null, default option is used. If option is not null, option.mode will be set to actual mode used if Start is successful.
Returns:

Success or failure reason.

public static void Stop()

Stop detection.

public static void UpdateResult()

Update frame index, left and right hand result.

You need to call this function periodically to get new detection result. The detection result is not changed until the next call of this function.

If frame index is negative, calling this function is a no-op.

public static native void UseExternalTransform(boolean value)

This function should be called before Start to indicate if caller is providing camera transform or not. Call it after Start has no use.

If set to true, hmd positions are not queried from raw HMD API from OpenVR or WaveVR. The caller is responsible for managing hmd positions using either of the two methods below:

This is useful if camera transform is different from raw HMD data, e.g. teleporting.

Parameters:
  • value – If use external transform or not. Default is false.