VRHandPivot ( hand )

Parameters

hand - 0 for the left controller, 1 for the right

Description

Returns a pivot that follows where a controller points.

The engine keeps the pivot at the controller's aim pose: the place and direction the controller points, as the VR runtime defines it for that controller, with the pivot's +Z along the pointing ray. Like VRHeadPivot it is a child of the camera you gave EnableVR, measured in world units from the seated origin, and it is moved inside RenderWorld before drawing, so a model parented to it is drawn where the player sees their hand.

While the controller is not tracked - switched off, asleep, out of view, or the program does not have the headset's focus - the pivot is hidden, and so is everything parented to it. It reappears when tracking returns. Use VRHandTracked to check before casting a ray from it.

The engine owns the pivot: do not free, reparent, hide or show it. If it is freed anyway, the next call returns a new pivot with a new handle. DisableVR and ShutdownVR free it, and after EnableVR moves VR to a camera in another world, call VRHandPivot again for the new pivot.

A pivot is returned even when no controller is connected yet. Returns 0 while VR is not enabled, or if hand is not 0 or 1.

Automatic VR is experimental, and works in 64-bit Windows programs through an OpenXR runtime and Direct3D 12. In 32-bit programs the commands are there, so the same source compiles, but InitVR returns False and VRLastError says why.

For the full story - setup, frame rules and limitations - see the Automatic PC VR guide and its complete AutomaticVR.bb sample.


See also: VRHandTracked, VRHeadPivot, VRButtonDown, VRAxis, EnableVR.

Index