Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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

Product Version: UE 4.9
more ▼

asked Nov 29 '15 at 04:39 AM in Blueprint Scripting

avatar image

46 7 8 13

avatar image zacharymwade Nov 29 '15 at 05:53 AM

What function are you using to detect the collision?

avatar image Takasu. Nov 30 '15 at 02:24 AM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

example.png (213.1 kB)
more ▼

answered Nov 30 '15 at 03:12 AM

avatar image

554 27 4 25

avatar image Takasu. Dec 01 '15 at 02:17 PM

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.

avatar image zacharymwade Dec 01 '15 at 02:21 PM

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

avatar image Takasu. Dec 02 '15 at 01:45 PM

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.

avatar image Takasu. Dec 07 '15 at 02:52 AM

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!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question