First Person VR

The First Person VR View Type works with the separate VR camera to position and orient the main camera GameObject. If Detect Object Clipping is enabled the view type will prevent the VR camera from clipping with other objects. Consider the following situation:

In this screenshot the selected collider is the character. The cube on the left is an object that the character should not move through. Because the player can physically move within their play area there is an opportunity for the camera to move into the cube:

In this situation the the view type will move the camera GameObject to the right so it is no longer obstructing the collider. This works by casting a ray from the desired anchor position to the VR camera’s position. The Additional Raycast Buffer field will extend the length of the ray to prevent the camera from getting too close to the object.

Recentering

The common way to recenter VR headsets in Unity is to call InputTracking.Recenter. When this function is called there isn’t a callback so the view type doesn’t know that it is being recentered. Ensure that the “OnRecenterTracking” event is sent immediately after the Recenter call so the view type will correctly readjust.

public void Recenter()
{
   InputTracking.Recenter();
   EventHandler.ExecuteEvent("OnRecenterTracking");
}

Inspected Fields

Look Direction Distance

The distance that the character should look ahead.

VR Camera

The camera which is used by the player’s head.

Parent Items VR Camera

Should the items be parented to the VR camera? If false they will be parented to the main camera.

Rotate With Character

Should the camera GameObject rotate with the character?

Detect Object Clipping

Should the camera detect clipping between the character and the vr camera?

Additional Raycast Buffer

An additional magnitude to add on to the object clipping raycast.