First Person Prefab falls through imported Terrain Model

Hi all,

I’m having a bit of trouble with imported terrain data - it first person controller falls straight down through it, even when I make sure that it was placed right above the model.

When I first imported the model it looked transparent with orange outlines of the tiles the terrain was broken into, and after adding a solid white material to it, the character still falls through. I added a video to show what happens:

I’m experienced with Unity, and any pointers in the right direction would help tremendously! I’m guessing it might have something to do with an object type.

Have you added a mesh collider?

I saw that around, but couldn’t find it in the Standard Assets. I’ll look for it in the store and get back tomorrow morning.

Mesh collider for 3d models:

Terrain collider for terrain data:

1 Like

A mesh collider is just one of the components that is in normal Unity (not an add on in standard assets). Simply click on Add Component and then I believe it’s Physics → mesh collider. It’s been a long time since I used the fpscontroller I believe it was actually a capsule collider on it.

But in general the only thing that is required is that there is some collider on both the character and the ground and that they don’t start overlapping (usually best to give a small buffer). If you weren’t using the character controller you’d probably also want a rigidbody on it but with a character controller it isn’t necessary.

https://unity3d.com/learn/tutorials/topics/physics/colliders?playlist=17120 (character controllers by default don’t use physics so a rigidbody isn’t necessary just the colliders)

https://unity3d.com/learn/tutorials/topics/physics/rigidbodies (if you ever want it to be actually physics driven)

1 Like

Many thanks for your responses!

I added both a mesh and a terrain collider to the ground, but my user still feel straight through my terrain. Is there anything else I could be doing wrong?

I also attached a screenshot with my inspector

1 Like

Alas I forgot the screenshot

3103365--234340--falling.png

You need to add the Mesh Collider to a gameobject that has the Mesh Filter of your Terrain’s 3d model.

Don’t worry about adding Terrain Collider, because you’re not using Unity’s built-in terrain.

Sorry for the slow response - I ended up on a different project for a while.

The main concern I have is that I’m not sure which mesh to apply the Mesh Filter to - I have a bunch of mini-meshes it looks like. I attached a screenshot of my dilemma.

And thanks for your responses!

3116961--235807--inspector.PNG

Each one will need a mesh collider, and the mesh collider should match the one you see on the mesh filter.

1 Like

You need to have a collider on both the terrain AND the player model as well. Make sure you have isKinematic off on the player RigidBody too!

1 Like

I added a mesh collider both my material and my FPS controller, but still fall through in the same manner as before. Should I add a material?

1 Like

In the original video, the player has a “CharacterController” so a rigidbody is not required on the player.

As per the new png image, I would think that a CharacterController would not fall through that gameobject, Unless there is an error in the console about "Cannot use non-convex collider … " error, OR the player’s layer and ground layers are not set to have Physics interaction in Physics Settings (doubt that).

So I don’t know what the problem is !

Another wild stab in the dark, could the terrain need to be static?

I was having a similar problem with an imported terrain.(Glowing Forest). I added a mesh collider and changed cooking options to everything (making sure I had a rigid body on my object that I didn’t want to fall through). Then I was able to add force or apply physics changes (I was testing a sphere with rigid body add force to move it (like the roll a ball tutorial).