Search Unity

Help with VR Player Collider

Discussion in 'AR/VR (XR) Discussion' started by Jschmitz, Nov 5, 2018.

  1. Jschmitz

    Jschmitz

    Joined:
    Apr 9, 2014
    Posts:
    2
    Hi,

    I'm trying to add some kind of collision to my player with the SteamVR asset.
    I parented a gameobject to my camera rig which i can then move. The gameobject has a rigidbody component.
    Now I want to prevent the player from falling through the ground, walking through walls/stick his head through the walls.

    I already got the latter working by attaching a capsule collider to a gameobject which is a child of the head camera. Is this the correct way to do it? Whats the best way to add roomscale collision to the player?

    Thanks in advance!
     
  2. MoMonay

    MoMonay

    Joined:
    May 9, 2018
    Posts:
    19
    The problem with that is if you collide with the wall your head will move in real life but the head in game will not, potentially inducing motion sickness. Also it may allow the player to see through walls. You can solve this by using a fade out.
    Here's an example of someone who succesfully has implented that:
    https://www.reddit.com/r/Unity3D/comments/80wu7i/using_a_screen_fade_in_vr_to_avoid_people_seeing/

    With steamVR you would use code like posted here to get a similair effect;
    https://answers.unity.com/questions/1258342/steam-vr-fade-camera.html

    If you don't want to reinvent the wheel and have these type of features ready available for free then I suggest you use VRTK, it's a framework that also uses SteamVR;
    https://vrtoolkit.readme.io/

    That way you don't even have to bother with these type of things.
    Good luck.
     
    threebeerhonesty likes this.