Sphere falling through floor

I made a little setup by following the tornadotwins tutorial on youtube with a sphere and i cant get it to work. The sphere keeps falling through the floor. This is my script i have applied to my sphere.

var speed = 3.0;
var rotateSpeed = 3.0;

function Update ()
{
	var controller : CharacterController = GetComponent(CharacterController);
	
	// Rotate around y - axis
	transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
	
	// Move forward / backward
	var forward = transform.TransformDirection(Vector3.forward);
	var curSpeed = speed * Input.GetAxis ("Vertical");
	controller.SimpleMove(forward * curSpeed);
}

@script RequireComponent(CharacterController)

You did put a collider on the floor, right? And nothing is set to ‘is trigger’?

the floor is a cube and it has a box collider and mesh renderer the sphere has a mesh renderer character controller the script attatched to it a sphere collider and a rigidbody.

I am having the same issue, with Unity 3.3, the floor is has a box collider and a rigid body. The sphere has a sphere collider and the following script:

var speed = 3.0;
var rotateSpeed = 3.0;
function Update ()
{
var controller : CharacterController = GetComponent(CharacterController);
transform.Rotate(0, Input.GetAxis (“Horizontal”) * rotateSpeed, 0);
var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis (“Vertical”);
controller.SimpleMove(forward * curSpeed);
}
@script RequireComponent(CharacterController)

The ball still falls through the floor.

Yeah I dont know i wish there was a fix to this

it’s moving too fast. The collider missed by a frame.

Ok first I attatched that script to my sphere and it says The class defined in script file name DontGoThroughThings.js Does not match the file name DontGoThroughThings is what i named it and technor you said that u made it so it dosnt use gravity, how on rigidbody?

and i dont entirely understand that collider missed by a frame… as my username says im a noob at unity…

I kind of had the same issue, but I made it so that it doesn’t use gravity. All you have to do is, in your inspector pannel, untick the box named “use gravity”. this helped me but it still floats in the air unless you place it on the ground.
Hope this helps

anyone? i need help

Alright I think I solved your problem. you need to add a mesh collider (if it doesn’t have one) then there should be three boxes you can tick in the mesh collider option in the inspector. tick the bottom 2 boxes.

I hope this works… well it worked for me

technor

I had the same problem. My sphere kept falling through the cube-floor.

What I did to fix it is to look at the Layer of the sphere and the cube. Both sdhould be set to default (You find Layer in the to part of the Inspector view).

Then you need to check if these layers are set to collide.
You do this by clicking Edit->Project Settings->Physics
Then find the box in the matrix where the layers collide and tick it off.

Now it should work. It did for me.

I ended up having to go into its RigidBody and freeze its Y position to get mine to work