Problem where player stops in Midair while grappling

I have 2 problems, One is that when I use the grappling hook, it has a default velocity and acceleration, I would like it to not have an acceleration, and just pull the player at a consistent velocity until he reaches the pull location.

My main problem is that he sometimes stops in mid air, as his acceleration runs out before he reaches the pull location, and he just hangs there, until I grapple again.

I think it is bad to use velocity for this.

You should make line trace for hook, then make capsule trace for character, and then interpolate character location to hook location (or nearest location) with lerp vector function.

I just looked it up, and it does seem much simpler than what I have, But you seem to need a Timeline to set the alpha for the lerp, is there a simpler way to increment the alpha?

Yes, with some function called in tick.

Create float variable MoveToHookAlpha and boolean variable IsMoveToHook in your class.

Create MoveToHook function.

In tick you should have Branch by IsMoveToHook, and call function “MoveToHook” by its true output.

when you get successful trace result, set IsMoveToHook to true and it will call MoveToHook every tick.

Your MoveToHook function will look like this

So you simply increase alpha by delta seconds and use it in lerp.

DeltaSeconds * 10 - to increase movement speed.

As you can see, in my example I also have “Movement Enabled” variable. I use it to disable movement during interpolation and enable it after, to prevent player input work during it. You could use something similar.

I used the exact same setup, “MoveToHook” function called in tick based on the condition.

Only instead of using Delta seconds, I tried using “Get Controller input → Get Input Key Time Down” and plugged that into alpha (Then had to multiply by 0.17 by trial and error to get a speed I liked.)

And then I already had a “set actor location” to the hook location directly when you’re within a certain range to prevent hang and Jitteri-ness.

It also preserves a bit of momentum when you hook while falling, Gives a slight swing motion that I kinda like.

Any reason why I shouldn’t use this setup?

My Only problem now is that when you let go, The character falls to the floor too rapidly.

So you move character only when RMB pressed, and until it reached 250 units before hook location? And minus 100 units by Z? So totally it 350 units

Yes, it’s important to me that the character only gets pulled when you hold the RMB, it’s been that way the whole time.

and I’m not dead set on the maths of 250 and 100 by Z, but that’s what looks good on the current placeholder animations.

I actually just changed it to Actor location + 100 in Z, Tolerance of 100, Move to Pull Location -100 in Z, looks like the guy is hanging by the gun.

Want to figure out why he’s falling so fast when I let go tho.