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"

My "Dash" ability has a strange offset

Hello all.

I tried to figure out how to make dash ability on my own, and this is what came on my mind, il be showing you blueprint: alt text

other part of blueprint is not that important but il show it too if someone needs: alt text

it was just some checking wether there is enought mana to cast Dash and is it on cooldown or not...

What makes the problem here, is no next two pictures: alt text

as you can see, i tried to dash in "Forward Vector" direction but my character is not moving right.

What could be the cause of this offset? is my question. alt text

As you can see the Dash ability works, but after some iterations of DashKinda Timeline in blueprint my character is moving other direction. Also, the "Clones" as i called them is some kinda of image of TPCharacter,but they will be deleted if i set their "Set life span" to something like 0.2 seconds, as it was my intentional speed. But for the purpose that i can take picture i set it to 800.

Also, blueprint has no compiler errors.

Product Version: UE 4.20
22.png (504.2 kB)
33.png (291.5 kB)
44.png (1.3 MB)
55.png (1.3 MB)
more ▼

asked Sep 12 '18 at 01:48 PM in Blueprint Scripting

avatar image

1 1 1

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

your script seems a bit over complicated and there are a few errors that i can see right off the bat. one of the errors i noticed is that your not using set locations for your timeline, instead you are using a get actor location which will result in an exponential acceleration. well that is unless your timeline float * forward vector = 1. still though its not the way i would do things.

in the picture below you will see an example of how your entire system could be done aside from the ability cooldown. in the picture everything prior to the set initialLocation node is for checking the mana and decrementing it. the we set the players location so we have a static value to work from. next we use the timeline (which controls the dash duration) as a alpha for a lerp which controls the start and end point of the dash. last we set the location.

another way do do all of this would be to set the max walk speed which may actually be a superior method as it will handle turning mid dash better. in the end what ive shown here is similar to what you have but simpler, more organized, and easier to read. this may not completely answer your question but its an example of how you could accomplish what your looking to do.

alt text

capture.png (300.4 kB)
more ▼

answered Sep 12 '18 at 03:10 PM

avatar image

10k 33 8 23

avatar image Amgorul Sep 12 '18 at 03:38 PM

Okay i see...Thank you for the answer.

Btw i tought of that solution via max speed, but i didnt like it. I will tryout that one you gave me.

One thing i dont quite understand is that lerp node, i never used it except in materials, but i will spare some of my time to understand how would it work in blueprints.

But tell me, whats the time of the your Timeline playing, for example: my Timeline: point(0) Time=0,Value=0 , point(1) Time=0.2,Value=190.

Also, you said there would be some exponential acceleration...I dont see any much of a change in my blueprint behavior, my distance from inital location to initial location + timeline value is constant and also speed of doing animations and stuff...

avatar image ThompsonN13 Sep 12 '18 at 10:37 PM

a lerp node just outputs a value between A and B based on the alpha, for example if you were working with colors and A = Red B = yellow, then at alpha 0 the out put would be red, at 0.5 orange, and 1 yellow. so if you use a timeline that goes from 0-1 you can get a range of values over time, in prior example this would result in the changing from red to yellow over a few seconds. in the dash example each time the timeline updates it sets the location of the player a bit closer to be by a tiny amount.

you asked what the settings were for the timeline i used but its posted in the picture, its currently set to be a value of 0-1 over 0.5 seconds.

caution the next part is badly explained and isnt that important. the exponential acceleration happens in some cases depending on how you use a timeline, like when there are not set static points for a begin and end point. if for example you used a get player location for pin A then the distance between the player and target would be smaller each update which would result in each update moving the character a larger percentage of the distance. its hard to explain, but imagine you are 10meters from a object and you split that distance into 10 sections so each section is 1 meter. now if you update the situation by moving forward 1 section so your at 9 meters left, the script would now recalculate the 10 sections as how far is it from you to the object, so each section would be 9meters/10. its a weird quirk you dont really need to understand and can basically ignore if you just use static distances.

avatar image Amgorul Sep 13 '18 at 07:14 AM

Hey dude i fixed it! Thank you for everything.

All i did is little modify my blueprint, like u said about that initial position, that was the main problem here. So after "Set Is Dash on Cooldown " i grabbed initial location of my player, and changed my dashkinda Timeline "Dash"-return value to 1500 and after multiplying Forward Vector and "Dash"-return value, and adding "vector+vector" -> "initial location + DashReturnValue*Forward Vector", i got proper behavior now! Also, i figured out that Lerp, but thank you anyway! :D

(comments are locked)
10|2000 characters needed characters left
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