Usman Ilyas
Usman Ilyas

Reputation: 116

Need to stop SteamVR camera seeing through walls

I am using player prefab from SteamVR Plugin. Whenever player touches an object with a Collider on it, camera sees through it. I am using 0.01 as minimum clipping value. I have also added Rigidbody and Collider on camera.

Upvotes: 1

Views: 1800

Answers (1)

z_build
z_build

Reputation: 76

I also do not have code currently but here’s a concept of how to approach the problem:

  1. Keep a trigger collider on the camera.
  2. Write a script that detects when that collider is within another collider (your walls). There is a method for checking if colliders are intersecting/overlapping
  3. If there is an intersect/overlap, fade the camera to black. If there is not, fade back.

Upvotes: 2

Related Questions