I have added a camera with a spherical empty to my model to view all angles, but the problem is that when I look up (during gameplay), the camera ends up below the floor (due to parenting), hence obscuring vision. Is there a way to prevent the camera from going through the floor? Thanks.
1 Answer
You can prevent the camera view from being obscured by sending a raycast from the camera to check if any object/mesh is in-front of, or behind the camera view, which is the Z-axis of the camera.
Here's a great tutorial exampling how to create and implement such a camera raycast for camera collision.
Tutorial
-
1$\begingroup$ I have actually tried this one in the past but it didn't work for some reason. I found another file with a setup that works for me anyways. Thanks. $\endgroup$– MinatoJan 5, 2022 at 20:43
-
$\begingroup$ Ah I forgot that Cotaks already gave you that blend on BA. My mistake. $\endgroup$– RPaladinJan 6, 2022 at 3:21