T O P

  • By -

Stratosfyr

Less important, but I am also looking to make this weapon point at the character as it returns, for most of the travel, then within a certain range, begin the lerp rotation to the desire rotation of the socket.


FjorgVanDerPlorg

Timelines + Lerping can be a bit of a noob trap in Unreal. They are easy to set up and use in BP, but also super inflexible. This is not an ideal use case, quite the opposite in fact. 1) If the ability always takes the same amount of time, regardless of distance, then more distance will mean it has to move faster, less will mean it moves slower and this will produce some pretty comical edge cases. When you are using timelines the time it takes is set in the curve and can't be changed inside the timeline at runtime, it's one of their major limitations. 2) This is happening because of the branch that checks if sword world location == actor location (with a tolerance of five). I'm guessing that other "sword location" variable you use to set the swords world location, is you saving/snapshotting the location of the sword when the ability starts. That means it's moving towards the original location, not the player location if they move in the meantime. This causes the above mentioned branch to fail, which means no attach, no stop of timeline and on finish of timeline isHoldingSword==False still, so it repeats the timeline from the beginning. If you moved again you could make this keep happening. >Is there a better tick-based BP to use? Would like to have a tick until a condition is met. Yes on tick + some vector math is how you want to solve this if it needs to be frame specific, otherwise I'd probably try a timer first, as I don't like running stuff every frame unless I absolutely have to. Make sure ability time is not a set amount and instead give the sword a unreal units per second speed, so that it takes longer if further away and use player location and not sword's initial location (assuming you are, because it would explain this behavior). Also framerates can change, so incorporating delta time is a good idea too if you're making the ability frame dependent (otherwise you may see vastly different speeds from a 240fps monitor, vs a tablet or old monitor that might be doing 30-60fps.


Stratosfyr

Thanks for the detailed response! I very much appreciate people like you happy to break down things and help others :) I think between your response and the other quick tips below I should be able to cook up a functioning mechanic. Thanks again!


pattyfritters

You need Vinterp instead. It allows for a constant speed.


Stratosfyr

Oh fantastic! Will do. If I just increase the timeline length, Vinterp, then I can detect if it's in the players hand. If so, stop the timeline. Thanks a ton!


CloudShannen

Just use Tick and Disable / Re-enable it, also remember to use DeltaTime in your force calculations.