Quantcast
Viewing all articles
Browse latest Browse all 146

How to stop seeing through a wall in VR?

I have a scene where I can teleport to anywhere on the terrain. Including vertical walls. When I teleport to another ground location, my camera is off the ground so I won't be able to look through the ground. When I teleport to the wall, my camera sits exactly at the wall so I can see the terrain and inside the building. Any ideas? - I've tried my putting my near view clipping at 0.01 - I've tried to set a box / sphere collider on it with a rigid body and my terrain has a mesh collider - It might be I need to add a lerp function? private void TryTeleport() { if(!m_HasPosition || m_IsTeleporting) { return; } Transform cameraRig = SteamVR_Render.Top().origin; Vector3 headPosition = SteamVR_Render.Top().head.position; Vector3 groundPosition = new Vector3(headPosition.x, m_Pointer.transform.position.y, headPosition.z); Vector3 translateVector = (m_Pointer.transform.position - groundPosition); StartCoroutine(MoveRig(cameraRig, translateVector)); } private IEnumerator MoveRig(Transform cameraRig, Vector3 translation) { SteamVR_Fade.Start(Color.black, m_FadeTime, true); yield return new WaitForSeconds(m_FadeTime); cameraRig.position += translation; SteamVR_Fade.Start(Color.clear, m_FadeTime, true); m_IsTeleporting = false; }

Viewing all articles
Browse latest Browse all 146

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>