Head Collider steam VR plugin

When I use the plugin everything works fine except the head collision with objects, such as walls … It collides the body and then you can move the head and see through the objects. Does anyone save how to fix this?

I have been able to solve the problem by following the steps below, you do not cause a collision with the walls but when you try to cross them with your head the image goes black.
Steps to follow:

. add a circle collider to the camera vr. And adjust the desired size. Activate Is Trigger and add a Rigidbody deactivate use gravity and activate Is kinematic.
!(http:///kunden/homepages/41/d782019693/htdocs/fotosBase/Desktop Screenshot 2020.01.09 - 16.17.37.54.png)
!(http:///kunden/homepages/41/d782019693/htdocs/fotosBase/Desktop Screenshot 2020.01.09 - 16.18.10.04.png)

.create a new c # script with the following code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR;

public class MyFadeCamera : MonoBehaviour
{
    private float _fadeDuration = 0f;

    private void Start()
    {
        FadeToWhite();
        Invoke("FadeFromWhite", _fadeDuration);
    }
    private void FadeToWhite()
    {
        //set start color
        SteamVR_Fade.Start(Color.clear, 0f);
        //set and start fade to
        SteamVR_Fade.Start(Color.black, _fadeDuration);
    }
    private void FadeFromWhite()
    {
        //set start color
        SteamVR_Fade.Start(Color.black, 0f);
        //set and start fade to
        SteamVR_Fade.Start(Color.clear, _fadeDuration);
    }

    public void OnTriggerEnter(Collider other)
    {
     
        FadeToWhite();
     
    }

    public void OnTriggerExit(Collider other)
    {
     
        FadeFromWhite();
     
    }
}
1 Like

Thank you.

Just a note: with the current (latest) SteamVR version you just need to tick “is Trigger” on the already assigned Sphere Collider on the Player Object (the default prefab in Assets/SteamVR/InteractionSystem/Core/Prefabs) and just to increase a little bit the size of the collider. Then you need to place the script provided on the HeadCollider object.

After that when you bump to an object which has collider on it, the screen will fade to black.

EDIT:

Not working in SRP(LWRP/HDRP):
https://github.com/ValveSoftware/steamvr_unity_plugin/issues/388

Thanks for this!! Much appreciated.