How to prevent first person camera from going through walls
I have a 3d house and I have a few cameras set up inside the house and its like a virtual tour. I have this script that I'm using for scrolling forward and panning left and right on my cameras- [1]: http://wiki.unity3d.com/index.php/MouseCameraControl
I would like to be able to prevent the user from going through walls. I have tried adding colliders and Ridgebodys to the camera and walls. I have also tried other solutions I have found on here but I can't get them to work. I have also tried to use this script as well- http://wiki.unity3d.com/index.php/DontGoThroughThings I would appreciate any help on this I have been stumped for awhile.
Answer by tormentoarmagedoom · Feb 29, 2020 at 01:16 AM
Hello.
The "correct" way is : I have tried adding colliders and Ridgebodys to the camera and walls.
Well, rigidbody is only needed in the camera object for your propouse. But everythign should have colliders. How are you configuring the colldiers?
I am using mesh colliders on all the objects I just have them with the default settings. I did play around with the settings but I couldn't get anything working. I will try just using the rigidbody on the camera to see if that works.
It's not working when I use a collider and rigidbody on the camera and just a collider on the game objects. Are there certain settings I need?
Your answer
Follow this Question
Related Questions
Camera Wall Collision is buggy 0 Answers
mouse orbit 0 Answers
Begginers question - already stuck 0 Answers
Moving Vehicle Not Stopping when Colliding with CameraRig (SteamVR) 0 Answers
Cinemachine collider clips through wall 0 Answers