1
\$\begingroup\$

I just start to learn HTC vive app development with unity and want to interact with Object and want to get it as controller interact with it. Try to learning form StreamVR Unity Toolkit documentation. I found a scene in sample demo where Gameobject are interacting through controller but there are so many scripts involved. I am amazed that on a cube VRTK_InteractalbeObject is attached and it is responding to controller. how can i get interacted object in htc vive.?

\$\endgroup\$
  • 1
    \$\begingroup\$ Could you clarify a bit? Interact how? \$\endgroup\$ – SurvivalMachine Sep 7 '16 at 11:40
  • \$\begingroup\$ @SurvivalMachine interact through controller and its buttons \$\endgroup\$ – Muhammad Faizan Khan Sep 8 '16 at 4:33
  • \$\begingroup\$ That doesn't narrow it down much. Every action you've ever done in a game has been done "through a controller and its buttons". We really need specifics in order to answer the question - are you talking about physically nudging the object around, or a picking/selection tool, or attaching it to your controller like a grab action, or...? \$\endgroup\$ – DMGregory Sep 17 '16 at 17:38
0
\$\begingroup\$

NewtonVR (github) is what I have used to make objects interactable. You can pick items up, throw them, push other objects with the objects you're holding and in general it behaves realistically. You can see animations of what it can do here.

Using it is very simple:

To integrate NewtonVR into a project you can use our included player prefab in NewtonVR\NVRCameraRig. This is a copy of the steamvr camerarig prefab with the newtonvr scripts added. Specifically, there's a NVRPlayer component on the root, a NVRHead component on the head, and NVRHand components on both hands. Alternatively, you can just add those components to your player. Take note though, if you're not using the standard controllers in your project then the physical hand option will not work correctly.

When you've got an item you'd like to pick up, simply drop a NVRInteractableItem component on it. You'll need to give it a Rigidbody (and ideally set the mass) if you haven't already. If the item has a specific point that you'd like to pick it up at you can create a new GameObject, parent it to your item, and position it in the location and at the rotation that you'd like the controller to be. Then set NVRInteractableItem.InteractionPoint to that new gameobject.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.