HTC Vive Tutorial for Unity | raywenderlich.com

A small update, @blackdragonbe.

I was able to get almost everything running fine. I just didnā€™t change the Steam VR Input window at all and used the ā€œstandardā€ controllers. That allowed it to work ā€œjust fineā€: I can see the controllers, interact (pick-up and throw) with some cubes, spheres and other objects (that have colliders on them) on my scene.

Right now, Iā€™m just playing with the script trying to add tags so that not everything that has a collider can be picked up.

Thank you for this tutorial and for still being active on this board :slight_smile:

1 Like

Hi @bmythes ,

Iā€™m glad you got it working! I have as suspicion that Valve changed something in their latest update thatā€™s causing the instructions in this tutorials to not match up anymore.

Thanks for your kind words.

Cheers,
Eric

Hi :slight_smile:

I just starten learning how to create VR experience using the Vive and found this cool tutorial.

I have the Same issue as mentioned a few times before: iā€™m Not able to see my Controllers. Even After just adding the Camera Rig Prefab and before Even touching any of the Steam VR Inputs. Does anybody have a hint for me how to fix this Problem?
I already tried a lot and just canā€™t get past this. But I really want to complete this Tutorial :slight_smile:

(Iā€™m using Unity 2018.3.5f1)

@blackdragonbe Can you please help with this when you get a chance? Thank you - much appreciated! :]

Unfortunately, this seems to be a SteamVR bug: HTC Vive Controllers not showing in scene Ā· Issue #323 Ā· ValveSoftware/steamvr_unity_plugin Ā· GitHub

One of the contributors to that thread has posted the following workaround:

New project in 2018.3.6f, import 2.2.0 Steam VR:

  • Move all JSON files in Assets/SteamVR/Input/ExampleJSON/ to project root.
  • Open SteamVR Input
  • Save and generate
  • Note, controller bindings now show default official vive_controller bindings
  • Run scene and controllers are now visible/usable

I havenā€™t had a chance to try this yet; but that might be good workaround for now.

Cheers!

Thank you so much! It worked and I could complete the Tutorial.
By the way: Your Tutorial rocks! Itā€™s very fun to play and I learned a lot from it - thank you!

1 Like

Hi just wondering if i could have some help with the velocity. Iā€™m using unity 2018.3.11f1 and have copied the code exactly but my objects just drop.

The ReleaseObject() method is responsible for giving any thrown objects the same velocity as the controller. It should look like this:

private void ReleaseObject()
{
    // 1
    if (GetComponent<FixedJoint>())
    {
        // 2
        GetComponent<FixedJoint>().connectedBody = null;
        Destroy(GetComponent<FixedJoint>());
        // 3
        objectInHand.GetComponent<Rigidbody>().velocity = controllerPose.GetVelocity();
        objectInHand.GetComponent<Rigidbody>().angularVelocity = controllerPose.GetAngularVelocity();

    }
    // 4
    objectInHand = null;
}

It gets called in the Update() method with this block of code:

if (grabAction.GetLastStateUp(handType))
{
    if (objectInHand)
    {
        ReleaseObject();
    }
}

Can you add the following code inside of that last outer if-statement to check if it gets called?

print("Released")

That should print Released to the console after you release an object.

Cheers!
Eric

it seems to be working its just sometimes not throwing it properly. might have something to do with how im throwing the objects tho

Hi there!

I ran through your tutorial and I got as far as finishing the grabbing and releasing mechanics. The code was excellent and I learned a lot from it! However, I think something must have gone wrong. After I set up the inputs in the browser window, the controllers no longer show up in the scene view. I am running Unity 2019.1.0f2, so Iā€™m not sure if that has anything to do with it, but the controllers just donā€™t show up. They show green in the SteamVR window, and I can even hold down the System Menu button to access the SteamVR menu where I can see the controllers just fine, but the moment I press play in Unity, the controllers disappear.

When I look at them in the scene view, they are at their starting positions. Also, in my version I had to change the SkeletonLeftHand and SkeletonRightHand type to ā€œposeā€ in order to assign it to the controllers. Could that be the problem? Either way, Iā€™ve gone through and double checked that Iā€™ve followed your tutorial to the letter but the controllers donā€™t show up. Iā€™ve even tried deleting the CameraRig and bringing in a new one. Doesnā€™t work still.

I love this tutorial and I think itā€™s very helpful, Iā€™ve just got no idea where I went wrong.

I could use your help when you are able!

Hi!

Thank you for your kind words, Iā€™m sorry itā€™s not working for you out of the box.

The tutorial was written with Unity 2018.3 in mind so Iā€™m not sure if 2019.1 will work correctly.
The latest version of SteamVR had some trouble even with 2018.3 and this was the workaround:

New project in 2018.3.6f, import 2.2.0 Steam VR:

  • Move all JSON files in Assets/SteamVR/Input/ExampleJSON/ to project root.
  • Open SteamVR Input
  • Save and generate
  • Note, controller bindings now show default official vive_controller bindings
  • Run scene and controllers are now visible/usable

This might work for 2019.1 as well. In any case, this tutorial will need an update for Unity 2019.1 and the newest version of SteamVR in the near future.

I hope that helps!
Cheers!

Hi @blackdragonbe,

I tried to follow your tutorial first with 2019.1.1f1 where I got tens of errors, then I installed the same version you mentioned, 2018.3 (although I have no idea which one was exactly yours, I see on the hub only 2018.3.14f1) and I also got errors complaining some IO errors on a fileā€¦

Edit: according to the dialog I see, it looks like you used 2018.2.14f1ā€¦ is that right?
Which exact version did you use?

Edit2: indeed with 2018.2.14f1 it works

@elect86 Do you still have issues with this?

since I installed 2018.2.14f1, everything is fine and smooth

I also had the issue with controller disappearing. The suggested solution above didnā€™t work so Iā€™m moving on for now, but will be using this as a reference!

# SteamVR: MismatchedActionManifest

Hello together,
I try to build this turorial but I always get a failure at the same point.
I am using Unity 2018 3.14 and the newest steam plugin from asset store, alternativ from GitHub, too.
Then I drag the CameraRig and SteamVR prefag in the editor and open up the SteamVR input window.
Even without manipulating the inputs, only by pressing Save and generate I get the failure
"Error loading action manifest into SteamVR: MismatchedActionManifest "

If I use the player prefab, everything works like expected.
But this is only a workaround for me.

Do you have any suggestion for me?

Thanks a lot, sts

Hi!

Unfortunately, Iā€™ve never seen this error before.
Thereā€™s an open issue on SteamVRā€™s Guthub page: steamvr version 2.2.0 "Error loading action manifest into SteamVR:mismatchedActionManifest" Ā· Issue #315 Ā· ValveSoftware/steamvr_unity_plugin Ā· GitHub

Have you tried the workarounds listed by users on that page?
As this is a SteamVR bug, thereā€™s not much we can do at this point.

With that said, if youā€™re eager to jump into VR, Iā€™d suggest looking into Unity XR, it works with all VR headsets and doesnā€™t require any extra plugins. Here are some helpful links to get started:

We will be focusing more on Unity XR in the future to prevent problems like youā€™re having right now, so stay tuned for more VR tutorials.

Cheers!

I tried the tutorial and it works totally fine! I can grab and throw the cubes.
But when i use my snap turn (i rotate the whole camera rig with pressing a button), the cubes fall in a wrong direction. I think the problem lies in a local direction of a velocity.
Can somebody explain how to possibly fix the issue?

@blackdragonbe Can you please help with this when you get a chance? Thank you - much appreciated! :]

blackdragonbe Hello. Iā€™m new VR developer. Great tutorial, thank you. I have a question, please. Is it possible to make child objects interactable(throwable)? If yes, how?
More precisely, I have fire extinguisher, I can pick and and throw this parent object. But it has child objects which also I want pick or move (hose, buttons, fuse). At this point child object being detached itself. But I want it should stay child. If you know, please, help me.