Unity: VR Head Blocking (Oculus Integration)
VRHeadBlocking.cs: using System.Collections; using System.Collections.Generic; using UnityEngine; // VR Head Blocking Script (Synaptic Response) // For use with Unity + Oculus Integration (v23.1) // Add this script to the CenterEyeAnchor component of the OVRCameraRig // If your player component has colliders set its label to "Player" // Initial Implementation: Scott Lupton (02.17.2021) public class VRHeadBlocking : MonoBehaviour { public GameObject player; private int layerMask; private Collider[] objs = new Collider[ 10 ]; private Vector3 prevHeadPos; private float backupCap = . 2f ; private void Start () { layerMask = 1 << 8 ; layerMask = ~layerMask; prevHeadPos = transform.position; } private int DetectHit (Vector3 loc) { int hits = 0 ; int size = Physics.OverlapSphereNonAlloc(loc, backupCap, objs, ...