How do I keep my camera from going through the floor?

Hello I’m trying to make a third person snowboarding game. The only problem is my camera goes through the ground on steep hills. If you have any idea on how to fix this I would appreciate it very much. thank you.

Well, it seems like you’re camera goes through floors only when big hills show up, so I am going to assume it’s because you’re camera is attached to the player ( or whatever you set it to ), and it’s translating on the y axis (with the player).

Maybe try dis-attaching, and having the Camera follow* you only on the x-axis and z-axis . Of course this might limit your angling etc, but, you can tweak if around to fit your needs, or even add colliders to the hills that signal the camera to move up or down along the y axis.

Plenty of ways you can go about fixing that. Either of the two above will at least get you past your issue .

We had this problem in early versions of our first game. Sadly the whole game was dropped before hitting release, but we had two options for the solution.

First, dropping a cast to the terrain from the camera every 0.1 seconds and adapting from that.
Second, adding a collider to the camera and making a flexible link between camera position (real) and camera position (ideal).

I prefer the first, as the second raises the possibility of the camera actually getting stuck in a rooftop somewhere, which would be embarrassing.

You need to make sure you have a terrain collider on your terrain and a camera collider. Also if it still goes through the ground, then raise it over like 1 unity higher than the ground. If ANY part of the Camera is in the ground it will fall through.