- Home /
The question is answered, right answer was accepted
Player Falls Through Floor on Trigger
I am using a script to reset the level when the player interacts with a gameobject. The player is an empty gameobject, a capsule, and a camera (with children). I added a mesh collider to the empty gameobject and set it as trigger, but nothing happened. I tried the same thing on the capsule. This worked, but the player keeps falling through the floor. How can I fix this?
Answer by MibZ · Sep 20, 2012 at 11:33 PM
You're either falling through the floor because the player is placed below the floor in the editor (just try moving the player upwards a little bit) or because you tried to make the floor into the level loading trigger.
GameObjects being used as triggers are ignored by physics calculations, so if you make the floor a trigger you will fall through it.
As for your empty GameObject - emptys have no mesh, so if you put a mesh collider on it you're giving it a collider that can't collide, so to fix that problem switch the mesh collider to either a box or sphere.
The player isn't placed below the floor. If I made the floor into the level loading trigger, I would end up resetting over and over.
I found a solution. I created a cube, scaled it down, deleted the mesh render, and set that as the trigger. It seems to work. Thanks for the help :)
If neither of those are the reason why the player is falling through the floor then it is probably caused by something you didn't mention here. $$anonymous$$aybe check to make sure the rigidbody component on the floor is enabled (the checkbox next to RigidBody in the Inspector tab in case you don't know).
Glad the other part worked though :)