Preventing the camera from going through terrain

Hey, the title says it all, how do i prevent the camera from going through the terrain using Javascript.

Im using the SmoothFollow script.

Take a look at the wow camer topic. I remember a long time ago doing something like creating a parent object with collider and adding one of the camera scripts to that parent, then have the camer as a child. :slight_smile: Hope this helps.:slight_smile:

Black Mantis, can you post a link to the topic?

A quick search for “Wow Camera” comes up fruitless!

[edit]

Could that be this thread:

Yup that looks like the right thread.

I’ve heard people using raycasting and such to stop the camera clipping too.

There are a number of resources for this.

There may even be one or two in standard assets.

Look at the Platformer Demo and the Penelope Demo. I know that each of them have a solution.