Player falls through Curved Mesh Colliders

When my player goes onto some curved part of a mesh/model, it falls. Here is a part of the model rendered in SketchUp;

33074-screeny.png

At the start/bottom of the loop, the player suddenly falls. The same thing happens to other models.

The mesh is a whole model that has a mesh collider. Straight surfaces seem to work but any surface which is in a different angle doesn’t work.

The player is a mesh with a box collider. It is controlled by the script used here ( Scripting: Unity 3D Tutorial (Part 5) - YouTube ).

I’ve edited it but I think they’re non-obtrusive additions.

// JavaScript Document
#pragma strict
var forwardRate : float = 3;
var turnRate : float = 2;

public var idleAnimation : AnimationClip;
public var walkAnimation : AnimationClip;
public var runAnimation : AnimationClip;
public var jumpPoseAnimation : AnimationClip;

function Update () {
	Speedy();
}

function Speedy() {
		// tank's forward speed in action
	var forwardMoveAmount = Input.GetAxis("Vertical") * forwardRate;
	// force of the tank's turn
	var turnForce = Input.GetAxis("Horizontal") * turnRate;
	// rotate tank in action
	transform.Rotate(0,turnForce,0);
	transform.position += transform.forward * forwardMoveAmount * Time.deltaTime;
	
   if (Input.GetAxis("Vertical") > 0.2)
       animation.CrossFade (runAnimation.name);
   else
      animation.CrossFade (idleAnimation.name);
}

I’d be so grateful for anybody who finds an answer.

If I’m not mistaken, by manually adjusting the transform.position value you are essentially telling the engine “put this thing here, ignoring any physical properties”. You are not giving the physics engine a chance to tell the model “hey, you can’t move that way, you’ll have to start going up the curved mesh surfaces”.

I don’t have the code at hand, but I had a similar problem I was working on but moving inside a tube. The code inside Speedy() should be calculating a force vector to apply rather than calculating the new position. By using RigidBody.AddForce() you are working “with” the physics engine instead of “against” it, telling the physics engine “hey, I’m nudging the physical thing this way, take it into account when you next calculate collisions and adjustments of position and orientation”.