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:

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

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:

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.

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.

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.

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…

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.

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! :smiley: