Detaching Actor resets velocity

Hello, I’m working on a platformer wherein the player can grab onto and swing on vines (forwards and backwards for now). Currently I have to attach the player character to a rope component (a series of static meshes linked together by physics constraints) but when I detach the player character from the rope component, the player velocity is zeroed and so doesn’t transfer momentum, whereas I need that so that they can launch into other vines and so. I’ve posted a picture of the before/after code.

Attaching:

Detaching:

From what I understand this zeroing occurs when detaching the actor from the other actor, I also have a Vector which is being set to the vine component’s current velocity as well. I was wondering if anyone knew a way to remove this zeroing or override it somehow.

As far as I know you can not use attach/detach when you want to preserve momentum like that. You would have to add force through some function after detaching manually.

To keep momentum you have to use a physics handle. With that you can do exactly what you want.

1 Like

That worked great, thanks :slight_smile:

You can actually use attach/detach and still preserve momentum. I’m doing exactly that in my current project and it works fine. UNTIL I also added collision response on/off.

If I only toggle physics simulation on attach/detach, then it works fine and momentum is preserved when releasing the actor. But if I also toggle collision on/off, then momentum resets. It doesn’t matter which order I do it in - if I detach first and then toggle collision or the other way around, or if I toggle physics first and then collision or the other way around - however I do it the momentum always resets if I touch the collision setting.

At the start of this project we used physics handles but it was very unreliable and didn’t feel very responsive in VR, so we switched to attach/detach and it immediately worked MUCH better, especially in VR.

How did you manage to make it work great using physics handles?

Tamlin, thank you! You just solved my momentum problem in VR. I was toggling collision. Now I just change Collision response to specific channels usign Set Collision Response to Channel and it works flawlessly.

I still use physics handle, but for opening drawers, cabinets etc. But for stuff supposed to be held in hand, it’s too laggy.

You could also save the linear and angular velocities of the component in variables just before the detachment. And set them to the detached component after. (I think it can’t be done on blueprint tho)