2D sprite falls through ground

Sorry if this is a simple question.

I have 2 players (fighting game)

Both have colliders and a rigidbody2D and the ‘Is Trigger’ On (this is for checking if the player is hit and stuff), now after putting ‘trigger’ on and I press play, both the characters fall through the ground (which also has a collider) which shouldn’t happen.

Before ‘IS trigger’ was turned on, they were both able to walk normally across the ground.

I’m new to Unity and just following tutorials (cant find fix)

So I’m looking for a way to fix this and make the players both step on the ground normally without turning off ‘Is trigger’, if its by script can you possibly do it in JavaScript (so I can try to learn and understand).

could you post a source code?

–

better you add a another gameobject only with jus a collider..

–

2 Answers

2

By making them triggers you are telling unity that you don’t want them to collide. So they will go through the ground collider. You need to uncheck the is trigger option like you had it before.

Is there a reason you want them to be triggers?

A collider is either a trigger or a solid collider. If you set isTrigger = true then that collider will go through all other colliders as it is a non-solid trigger. If you need both then I’d suggest adding a child with the trigger.