- Home /
Player keeps falling through the floor and I'm really stuck
Hi,
I'm making a Zombie Runner game and when I put in the Rigidbody FPS Controller, (I renamed it Player) at first it could move slowly, and then I deleted the enemy and then now the player is falling through the floor. The asset which the ground is in is called Prototyping (something like that) and came with the floor so I used it and I'm really puzzled. Could someone help me with this problem?
Thank you,
-Z0311A
Answer by mlnczk · Aug 06, 2019 at 09:27 AM
You have to make sure that your ground has collider and has not checked "Is Trigger". Also check if your zombies/player have Rigidbody.
Hi @mInczk, Which component collider? And yes my player's and zombies have Rigidbody.
If your object has Rigidcollider which means Physics it needs to touch some collider because otherwise gravity will drag it down through the floor. So check if you floor have any collider attached to it. If it has then check if this collider component has "Is Trigger" box checked. It needs to be unchecked to stop your rigidbody from going through it
I had the same problem. After reading the comments, even though I placed Mesh Colliders on the roads and buildings, somehow the program did not save it. So highlighting all the objects and then add component Mesh Collider did not work. Went back in and from the Y view on the Gizmo, I selected each one and added the Mesh Collider one at a time until all was done. Now the character is not falling through the road. A little frustrating after fighting it for two days straight.
Answer by MeowgicalLynx · Aug 06, 2019 at 01:05 PM
But the problem is not fixed; It worked just now, but then when I added my enemy in, (sorry but I did not tell you that maybe the enemy was the problem) the player couldn't move (W, A, S, D) and then when I deleted the enemy, the player fell through the floor and then I tried adding Box Collider instead of Mesh Collider in the floor and it didn't work.
So what I think is that when I added the enemy/zombie Unity got confused with the two Rigidbodies and let the enemy walk around and chase the player as the player falls through the ground and can't move.
I'm not really sure about my speculation but how can I fix this please?
Can you take a screenshot of the enemy, ground, and player inspector plz?
@jacksonacademyashmore here's the screenshots:
Ground: https://i.imgur.com/AoNb$$anonymous$$Q0.png
Answer by Trumped · Aug 07, 2019 at 05:31 AM
@Z0311A make sure you don't have a mesh collider on an object with a rigidbody attached unless the rigidbody is convex this my be what causing your models to fall through the floor.
@Trumped the enemy has a Nav $$anonymous$$esh Agent, but I removed the $$anonymous$$esh Collider from the floor, so now the player isn't falling (that problem fixed) but the player is moving really slow that you have to get your eyes adjust to it so you can see it's moving.
Answer by RehanSanish · Nov 28, 2021 at 10:38 PM
@MeowgicalLynx, Is your project 2D? If it is, switch to Rigidbody2D. And if Is Trigger is on, turn it off. I think you have the trigger set to work when an enemy is doing something the script is programmed to. Make sure you did not delete the script. It's okay if you just delete the GameObject where the script is contained. But if you did delete the script entirely, turn of Is Trigger. I hope this works!
Your answer
Follow this Question
Related Questions
Player movement 1 Answer
Rigidbody2D character getting stuck when jumping on platform at climax point 0 Answers
Character rotating to previous rotation 1 Answer
How to make an object move to another object's location in a 2d game? 2 Answers
Mouselook problem multiplayer. Synchronized in 2 computers. 2 Answers