Simple Mario head stomp

Ok, I was trying to create a simple sidescroller AI that would die when headstomped by the player using a simple detection if the player is falling, I didn’t want to take on to vectors and detect if his speed is negative and anything like this, but I’m not able to cast the “Is falling?” node on the cast inside the AI blueprint, so how do I work around to do a simple headstomp? I’m a pretty noob programmer since I’m mainly an artist, sorry if the question sounds dumb

What function are you using to detect the collision?

its a hit event, if player hits it while falling, he dies, I already changed it to “if player Z speed is below 0, he dies” because the player is treated as falling if he jumps just beside the bot and the effect was awkward… and I am almost figuring it out, its just that it won’t die if I hit him just on the tip of its head, but will die if I hit him diagonally… something’s strange. I’ll come later with screenshots, away from engine right now.

You can use something like the following to get rather accurate results: {Refer to the Example.png, seems Answerhub decided to bug out on me.}

However, if you “want” you can check if the player’s z velocity is less than 0 rather than if he is falling. The dot product between the hit normal and the actor’s up vector will be -1 if the hit is EXACTLY up (and therefor dead on the head). However, that is unlikely to be the case, so using a nearly equal node you can test “how close” the collision is to being exactly on the head. I used .3 tolerance because that gives a relatively accurate result, anything higher than .3 will give the character a lot of leeway in where he hits the npc and anything less will mean the hit will have to be closer to “exactly” upwards. I do not recommend a value of 0 or a value higher than or equal to .5 as if I’m not mistaken that will allow the player to hit the NPC on the side.

Im having some issues with this model, if I jump directly on the peak of the capsule, it doesn’t recognize the hit on the AI, but recognizes the hit on the player, but if I hit diagonally, it is recognized normally, the AI is stomped and the player isn’t hit.

Hmm, weird, I did a good bit of testing before posting that. Is yours set up the exact same way or any variations?

I’m on my workplace right now and testing it again, this pc has 4.9.2 installed, and testing on the default side scroller template, on the default map, having the same issue, if I try to jump on the peak of the head it doesn’t recognize the hit correctly, player character just bumps over it and its done, if I activate the “player character can step on it” it just stops bumping, but doesn’t recognize the hit. However, if I hit diagonally, the hit recognizes correctly multiple times in a row. must be something on the components.

I forgot to answer, but I found out that I had another thing bugging my blueprints, so yeah, it is correct, thank you zachary, it works!