UI.InteractVolume

static BtnState InteractVolume(Bounds bounds, Handed& hand)

   
Bounds bounds A UI hierarchy space bounding volume.
Handed& hand This will be the last hand that provides a pinch state within this volume. That means that if both hands are pinching in this volume, it will provide the Right hand.
RETURNS: BtnState This will be the pinch state of the last hand that provides a pinch state within this volume. That means that if both hands are pinching in this volume, it will provide the pinch state of the Right hand.

This watches a volume of space for pinch interaction events! If a hand is inside the space indicated by the bounds, this function will return that hand’s pinch state, as well as indicate which hand did it through the out parameter.

Note that since this only provides the hand’s pinch state, it won’t give you JustActive and JustInactive notifications for when the hand enters or leaves the volume.

Examples

This code will draw an axis at the index finger’s location when the user pinches while inside an InteractVolume.

UI.InteractVolume

// Draw a transparent volume so the user can see this space
Vec3  volumeAt   = new Vec3(0,0.2f,-0.4f);
float volumeSize = 0.2f;
Default.MeshCube.Draw(Default.MaterialUIBox, Matrix.TS(volumeAt, volumeSize));

BtnState volumeState = UI.InteractVolume(new Bounds(volumeAt, Vec3.One*volumeSize), out Handed hand);
if (volumeState != BtnState.Inactive)
{
	// If it just changed interaction state, make it jump in size
	float scale = volumeState.IsChanged()
		? 0.1f
		: 0.05f;
	Lines.AddAxis(Input.Hand(hand)[FingerId.Index, JointId.Tip].Pose, scale);
}




Found an issue with these docs, or have some additional questions? Create an Issue on Github!