- Home /
platform 2d about collider
i am making a Mario like game as my first project. I put two 2Dcollider on the main player, one capsule as body and one Box as feet. I was planing like if enemies touch the body, the player dies, if the player steps on the enemy, the enemy gets killed. But when I use like "OnTriggerEnter2D", "OnCollisionEnter2D", the methods do not detect which collider touches the enemy, which means either I get invincible or I can't hurt the enemy. How do I fix this problem? Thank you.
Answer by theawesome1 · Oct 06, 2020 at 05:44 PM
watch this video to learn how to make the stomping thing that you wanted to do. I think it has a different method for killing enemies than you https://youtu.be/ycG60lHeTKg
Answer by frknerstr · Oct 06, 2020 at 06:43 PM
Have you added RigidBody to your character? Sometimes this can be overlooked.
Answer by arvindchetu · Oct 08, 2020 at 01:07 PM
Hi @Youngken I will recommend you to use simple Bool for each collision. If Player feet collides with enemy first, then mark Feet bool true and other one as false.
By doing this there will not be any conflict.
Thank You!