1

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.

Usman Ilyas
  • 106
  • 1
  • 11
  • your camera has a minimum render distance, the near plane. you´d need to stop your object before that to stop looking through it. maybe encapsulate your camera in anoter collider, that is further from the camera than the near plane – Nefrin Feb 27 '18 at 14:00
  • I have tried it already. This doesn't seems to work for me. – Usman Ilyas Feb 27 '18 at 14:20
  • If i stop my camera object from entering in wall mesh, its collider stays out but in headset view, it is entering inside wall. – Usman Ilyas Feb 27 '18 at 15:46
  • Well then you might consider implementing something like Crytek does in The Climb where the screen turns black if you stick your head into a wall. – Nefrin Feb 27 '18 at 16:07
  • I currently don´t have the time looking into this myself so I can´t really help you with this. Also the downvote is not mine. – Nefrin Feb 28 '18 at 08:26
  • Well thanks for your time. – Usman Ilyas Feb 28 '18 at 10:26

1 Answers1

2

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.
z_build
  • 76
  • 4