- Home /
Question by
erictheded · Jul 13, 2014 at 11:24 AM ·
physicsontriggerenterjumping
Can CollisionFlags and OnTriggerEnter work together?
Hi. I'm very new to this so please forgive my ineptitude. I'm trying to make it so my player damages enemies by colliding with them from above, in other words jumping on their heads. I get no errors with my script but it also doesn't do what I want. The player damages the enemy no matter what direction the player comes from and I can't figure out why.
function OnTriggerEnter(jumpDamage : Collider)
{
var controller : CharacterController = GetComponent(CharacterController);
if (controller.collisionFlags == CollisionFlags.Below && jumpDamage.tag == "Enemy")
{
print("Head Stomped!");
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613153935im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to move while jumping? 1 Answer
Movement Script for Player... 1 Answer