Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Anonymous's avatar
Anonymous
7 years ago

Camera entering objects

I have several imported .obj files in my game. These object's only components are mesh renderers. The only issue I am having with them occurs when the player approaches these objects from certain angles. If approached from just the right direction the player camera will end up essentially inside the object. Essentially if the player "slides" alongside the object at the right angle they end up partially inside it. They cannot walk through the object or anything just get a glimpse of the poorly rendered interior. How can I prevent this? I have tried adding rigid bodies and colliders to the player camera but the effect remains. Any ideas? Thanks.

4 Replies

Replies have been turned off for this discussion
  • try adjusting your near clip plane on the eye camera/cameras. a lower value should fix that
  • Anonymous's avatar
    Anonymous
    Thanks for the tip! However when I lowered the clip plane to the minimum value I still found myself just breaking through the object surfaces. Increasing the clip plane of course made things much worse so if I could just lower it further I feel it might solve my issue. Is there anyway to lower the clip plane below 0.01? I tried increasing the skin width of my character controller as well which marginally improved things but I still found myself inside the objects. Is it possible that something is wrong with my import? Thanks.
  • I think that's as low as it will go. Not too sure what it could be if it's not the near/far clip plane, but a couple of things you might check  are whether your camera is set to orthographic or perspective, and also maybe doing an HMD recalibration if it's been a while.
  • vrdaveb's avatar
    vrdaveb
    Oculus Staff
    My recommendation would be to use a script to fade to black when the camera goes inside of an object it shouldn't. You can detect this using Colliders or by raycasting (or in a couple of other ways, such as sphere testing). For a good example, see CharacterCameraConstraint.cs in our Sample Framework's Locomotion2 sample. https://assetstore.unity.com/packages/templates/tutorials/oculus-sample-framework-82503