x

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"

2d paper, stop jumping midair (due to hitting a block and destroying it)

So i just started with unreal engine, and so far I love it, found some amazing tutorials online but one thing I havent been able to solve is how to hit a 'breakable block' (think mario when you destroy blocks by jumping under them), I managed to make a poor script killing enemies by jumping on them using 'Sphere trace by channel, so i added it slightly under my character and if it hits the object, kill it)

But when having a breakable block, if i would use the same method, the block would break and i'd pass through it, so I need to be able to tell my character that this particular jump, has ended.

Also when using 'sphere trace by channel' it ends up being in the middle of the charater, so if you are on the very edge of an enemy, the sphere will never hit the enemy thus you can land on it and die, i never found a workaway aronud it yet...

Here are the screenshots of me checking if an enemy is killed: http://i.imgur.com/EiXVzqE.png http://i.imgur.com/MTM6UJ7.png

Is this the proper solution i should use? If so how would you solve to stop jumpnig midair, or is there some other way? Links to idea, tutorials, a point in the direction, i'd love any help I can get!

Product Version: Not Selected
Tags:
more ▼

asked Mar 13 '15 at 06:27 PM in Blueprint Scripting

avatar image

zampa86
3 1 4

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

3 answers: sort voted first

Well a few things. First of all to fix your issue with the sphere being in the middle of your character you can (instead of the actor location first calculate the lowest point of your character ("Get Actor Up Vector" -> multiply with negative "Get Half Capsule Height" (simply by multiplying that with -1) and then add that to your character location). Then for the radius just use the same one as your capsule component (which you can get as well) and it should be impossible to not hit the enemy.

For your current issue... you could do a simple "Single Line Trace" and pass down an interface event and in any way set your Z velocity to 0 as Furroy said (which you can do via "Get Character Movement Component" -> "Set Velocity" = "Get Velocity" -> "Break Vector" -> "Make Vector" (X = X, Y = Y, Z = 0) and then if the block you hit implements the interface do whatever (spit out a coin, destroy... whatever ;)

I hope this helps.

Cheers

more ▼

answered Mar 14 '15 at 02:09 PM

avatar image

Erasio
5.9k 291 86 293

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

I could hardly follow all that, but to make a character stop moving, get the movement component and then use the SetVelocity node to make it 0,0,0 The character will stop and then gravity will pull down on them as normal unless you also do something to counteract it.

more ▼

answered Mar 14 '15 at 01:22 PM

avatar image

Furroy
696 26 86 62

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

Thank you both, that did the trick!

more ▼

answered Mar 14 '15 at 04:44 PM

avatar image

zampa86
3 1 4

(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