text
stringlengths
0
1.11k
Assign the new GameObject to the HandGrabInteractable.
Option B: Use the scale slider
In the HandGrabInteractable component, move the ScaledHandGrabPosesKeys slider to the 0.8x and 1.2x position.
Click the Add HandGrabPose Key at X scale button to create the keys.
(Optional) Tweak the fingers and surfaces in the newly created HandGrabPoint GameObjects under the HandGrabInteractable.
In the Inspector, move the ScaledHandGrabPosesKeys slider while watching the scene view to ensure that the transitions between the different hand sizes are smooth.
Back to top
Mirror a pose
You can mirror a HandGrabPose either manually or automatically so the pose exists for both hands.
To create a mirrored pose, do one of the following.
Option A: Mirror manually
Option B: Mirror automatically
Option A: Mirror manually
Duplicate the HandGrabInteractable.
In Inspector, change the Handedness property of each HandGrabPose GameObject.
Manually reposition each HandGrabPose so it aligns well.
Option B: Mirror automatically
Under Inspector, in the HandGrabInteractable component, ensure the HandGrabPoses you created are listed in that hand’s HandGrabInteractable.
In the component, click the Create Mirrored HandGrabInteractable button.
The HandGrabInteractable is duplicated while mirroring all the HandGrabPoses into a new HandGrabInteractable.
(Optional) If the mirroring for the generated poses happened on the wrong axis, move the transform of the HandGrabPose to the desired position.
Back to top
Related topics
To learn more about HandGrabInteractor, HandGrabInteractable, and HandGrabPoses, see Hand Grab Interactions.
For the Mac version of this tutorial, see Create a Hand Grab Pose (Mac).Use Active State
Unity
All-In-One VR
Quest
The platform for which this article is written (Unity) does not match your preferred platform (Nativa).
Haz clic aquí para ver la página del índice de la documentación para tu plataforma de preferencia.
In this tutorial, you learn how to use Interaction SDK’s Active State in two scenarios that you should complete in order. Active State checks for a specified condition and returns a boolean. For example, Active State can tell you if your hands are active, if your controllers are grabbing, or if your hands are matching a specific pose. You can check elements, like hands or controllers, GameObjects, or interactors for their Active State.
This tutorial includes two scenarios that you should complete in order.
Check state of one element
Check state of multiple elements
Before you begin
Complete Getting Started with Interaction SDK.
Check state of one element
To check the state of an element, you use the corresponding ...Active State component. For example, hands use HandActiveState, GameObjects use GameObjectActiveState, and interactors use InteractorActiveState. In this scenario, you’ll check the state of the grab interactor for the left hand and cause a cube to glow green whenever the state is true.
In Unity, in the Project window, search for HandGrabExamples. Ensure the search filter is set to either All or In Packages, since the default setting only searches your assets.
Open the HandGrabExamples scene. This scene already includes grabbable objects, so you’ll use this scene instead of a new scene to save you time.
Under Hierarchy, create a Cube GameObject by right-clicking in the Hierarchy and selecting 3D Object > Cube. This cube will visually display the active state by glowing green whenever the active state is true.
Under Hierarchy, select Cube.
Under Inspector, in the Transform component, set the Position values as follows.
X: 0.002
Y: 1
Z: 0.68
Set the Scale values to 0.1 for the X, Y, and Z axes.
The cube is now positioned just in front of the Dialog GameObject so you can see it while you’re interacting with the scene’s grabbable objects.
Add an Interactor Active State component by clicking the Add Component button at the bottom of the Inspector and searching for Interactor Active State. This component will track the state of the grab interactor.
In the Interactor Active State component, set Interactor to the HandGrabInteractor GameObject, which is located under OVRCameraRig > OVRInteraction > OVRHands > LeftHand > HandInteractorsLeft > HandGrabInteractor.
Set the Property field to Is Selecting, since for this tutorial you only want to detect when the hand is grabbing.
Interactor and Property properties
The Interactor and Property fields of the Interactor Active State component.
Add an Active State Debug Visual component, which changes the color of its GameObject when the assigned active state changes.
In the Active State Debug Visual component, set the Active State field to the Cube GameObject.
Set the Target field to the Cube GameObject so the cube is what changes color when the state changes.
Debug visual properties
The Active State and Target fields of the Active State Debug Visual component.
Prepare to launch your scene by going to File > Build Settings and clicking the Add Open Scenes button.