HTC Vive Tutorial for Unity

Hey @fgamerz303,

Could you open the completed project and see if you get the same issue there?
I think I had this same issue while creating the tutorial, but I fixed it using
some extra logic in the teleport script (and the tutorial).

Cheers!

This is from the completed project, I still got the same problem with the completed project.

@fgamerz303

Right, in that case I probably forgot to fix that bug. Iā€™ll look into it! :wink:

Cheers!

Thank you !!! :smile:

Very interesting tutorial ! thanks a lot !

is it possible to grab an object and manipulate it with rotation or postion limits as a rear view mirror by example ?

Br

Hey @johnd !

Thanks, Iā€™m glad you enjoyed it.
Thatā€™s possible, but youā€™ll need to add a parent to that object and either set up the limits with a joint or in LateUpdate().
I donā€™t have an example ready though, I havenā€™t tried this myself yet.

Cheers!

Unity released Unity 5.6 and I had an issue with the controllers never enabling.

This fixed my issue ā†’
Vive controllers not tracking in Unity 5.6

The tutorial was great for HTC Vive with Unity! Iā€™ve gone through the trigger grab and laser pointer, and Iā€™m on the teleporter next. Iā€™m a dev who anticipated VR, and became a dev to work with VR. Iā€™ve made some amazing code in my beginning years, and I currently work for a biotech company, working on their LIMS (Laboratory Information Management System). My free time is working in Unity with HTC Vive. Your site popped up out of a group of others, and tested the group, and yours stood out the most to me. You have the best content choice out of the others. Maybe others will miss this site, but your content was exactly what I needed to get going. Great, to the point information. Maintain this path, and you guys will get noticed. I donā€™t see how not. If anything, gain thankful supporters :slight_smile: I want to help support you guys. If you need feedback or anything, just let me know. :slight_smile:

A fan!

Jon

1 Like

Hi there, great tutorial. For the most part Iā€™m up and running. Iā€™ve incorporated this into a Unity scene that I developed just for VR. Itā€™s an outdoor scene. I have normal terrain, as well as some 3rd party 3d models and what not. I have some cliffs as part of those models.

Something Iā€™ve noticed is that my laser will shoot right through the cliff and ray trace right into the terrain behind it. This puts me inside of my cliff model.

My cliffs are NOT part of the hit layer that Iā€™ve setup, so I would think that the ray trace would fail, but for some reason itā€™s not.

Was hoping that someone here might have a suggestion as to why my raytrace is allowing me to go through the cliff model.

Thanks in advance!

Rick

Oh yeah, another issue that Iā€™ve developed is that my controllers have gone white. As if they have somehow lost their rendering material. Not sure why or how, but it has.

And while on that subjectā€¦ Inside the SteamVR folders in Unity. Is there any reason we must import the InteractionsSystem folder?

Hey @rickblacker !

The laser looks for a collider, while a terrain made in unity doesnā€™t have a normal collider AFAIK, thatā€™s probably why itā€™s doing that.You could try adding a Terrain Collider, but I havenā€™t used that myself.
Does the cliff model have a mesh collider attached to it?

The white controller issue is a bug in in the SteamVR plugin when you use Unity 5.6, this should get fixed once Valve releases an update.
The InteractionSystem is used only by the examples scenes and prefabs, you can delete those if you want, SPOILER Iā€™m working on the next VR tutorial where weā€™ll make our own interaction system thatā€™s easily modified and built upon without relying on the example scripts.

I hope this helps!

Cheers!

@jcameron47

Thanks for your kind words! Be sure to check out the next VR tutorial soon! :smiley:

Cheers!

1 Like

Hi there,
I am loving the tutorial so far, but I have encountered one, strange issue.
In a custom scene when I throw the ball, it acts almost as if it is underwater. Whereas when I download your scene and use it, it works smoothly. I have double checked and the scripts are the exact same, as are the objectā€™s properties. Any idea what could be causing this?
Siltuz

Hi,

Iā€™ve been through this before. You will have to apply a bounce property to the ball. Check this unity tutorial on it - Physics Challenges - Unity Learn

Hope it helps,

J

Thanks for the suggestion!

I am afraid however that I already had a bounce property on the ball, and I have just gone through that tutorial but I am afraid the issue is still there. It is not so much the bounciness, but more that it feels like the ball is not maintaining the velocity at which I throw it. It instantly slows down when I let go, and messing around with friction and drag does not seem to change that either. It really does feel like when you try to throw a ball underwater.

Hey @siltuz ,

Some things to check:

  • Did you import SteamVR yourself in that project? SteamVR sets the physics update framerate to be the same as the visual framerate by default.

  • Did you add the controllersā€™ velocity and rotational velocity to the ball when you release it? Not doing this will result in the ball dropping straight down, like you tried to throw it in thick jello or something. This is how it looks like in the tutorial:

      objectInHand.GetComponent<Rigidbody>().velocity = Controller.velocity;
      objectInHand.GetComponent<Rigidbody>().angularVelocity = Controller.angularVelocity;
    

Hope this helps!

Cheers!

I did indeed import SteamVR into the project myself. Is there some way I can check the settings for this?

And I have the exact same code as you have put there in my script. Infact I double checked the code by swapping the file with the one from your project file and then trying it, so still no luck I am afraid. It feels like it is not taking on the velocity, but it does take on the angularVelocity, I honestly have no clue how to fix this.

Thanks!

Siltuz

Perhaps this is addressed somewhere in this thread. I follow your script and all works right up until the teleporting. LaserPointer works fine, but when I add the teleport functions you describe and go into the game - no more lasers and no teleporting. I remove the teleport calls and methods. Lasers working fine. Scripting looks exactly as you have outlinedā€¦so what could it be?

Iā€™m afraid my issue comes right at the start - when I make the box collider it looks perfect in scene view but it doesnā€™t stick to the controllers in the game view, like it has a different centre of rotation. Help!

@stephanfitch @melnick

Iā€™m about 99% sure these issues have appeared since the new version of Unity. For some reason SteamVR is more unstable than ever since 5.6.
Do these issues also come up if you download the final project and play the scene in that one?
Could you try adding a Steam Vr_Update Poses component to [CameraRig] \ Camera (head) \ Camera (eye)?

Iā€™ll see if I can find some time to go through this one again soon to fix the issues the update has brought forth.

Cheers!