Collision problems with level design

Hi there,

I have:

A Level: Modelled & Textured in Cinema4D R11 - saved as FBX and placed into Unity. This model has a mesh collider attached with the appropriate mesh.

A Character: For test purposes i'm using the FPS Character prefab that comes with the Standard Assets. I have made sure that the Player Controller is in the right place and the skin is set to 1.

However my problem is that this character can walk straight through parts of the level if hit at the right angle or if heading towards a slope without jumping it will go straight through. I also have fairly large 'tree roots' that lay on the floor accross a path however the character can walk through those also.

Anyone have any tips? would be very handy!


Some things you can try:

Only do movement in FixedUpdate so that it's in step with the physics simulation (not really practical but an option)

Move your character with velocity instead of transform.position as you might end up inside the terrain if you move too fast horizontally into a slope.

Decrease the fixed time interval to make physics calculations more frequently per frame, this will help stop your character from going through things if it's moving too fast.

Use a different collider, either box or capsule as mesh colliders are more prone to getting stuck in things, also it'll be faster. If you're using a mesh collider make sure it's set to convex otherwise it wont collide with other mesh colliders.

Place box colliders in the terrain where clipping is likely, this will act like reinforcement for areas with an odd shape. Typically developers will place invisible walls around areas where the player isn't meant to go, that's perfectly fine so long as it's not too obvious to the player.