Rigidbody (with Box Collider) falls through floor

Hej fellow Unity users!

As stated in the title of my question I got a problem with rigidbodies falling through the floor. I’ve done my homework and googled for it but the most answers were “turn isTrigger off” and “don’t user mesh colliders”. As seen on the picture below my bullets seem to rest on a plain inside my solid floor that has a box colider attached to it (that is not a trigger and is 2 units thick).

I spawn my bullets via code and attach a rigidbody and a box collider to them at runtime in a update function (could that be an issue?)

I’m often struggling with the phsysics in Unity, seems we two got some problem, hope you guys can give me some hints.

The Code that spawns the shell:

	public void SpawnShell() {
		GameObject go = GameObject.Instantiate(ShellPrefab, ReferencePosition.position, Quaternion.identity) as GameObject;
		go.AddComponent<BoxCollider>();
		go.AddComponent<Rigidbody>();
		Parenting p = go.AddComponent<Parenting>();
		p.Parent = "EMPTY_SHELLS";
		go.transform.rotation = Random.rotation;
		go.name = "Empty Shell";
		//go.rigidbody.AddForce(0f, Force, 0f, ForceMode.Impulse);
		//go.rigidbody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
		Destroy(go, DespawnTimer);
	}

**EDIT: still don’t have a clue. I know there have to be some inaccuracies in order to perform in a certain speed but I don’t know why this doesn’t work :frowning: no one any idea? **

EDIT 2: I’ve set the “Min Penetration For Penalty” in the Physics Project settings from 0.01 to zero. Now it looks better but not quite perfect because the box colliders are still half in the floor

Regards
Mexallon

I’ve set the “Min Penetration For Penalty” from 0.01 to 0 in “Project Settings->Physics”. This seems to solve the problem more or less. As also stated in the comments I think the same way that the bullets may be to small or my physics settings are not properly.