How to reset velocity of falling object on grab (VR) ?

Hi !

I figured that if I grab a falling object it keeps his falling velocity. The problem is that, then, I cannot “throw” it away, it immediately falls to the ground. But, if it let this same object fall and stay still on the surface it’s on, i’m able to throw it because it has no velocity (I guess).

I tried to modify the OnGrab component to set the object velocity to 0x0x0 with the “Set All Physics Linear Velocity” node but with no success. I also tried to do the same on my VRPawn blueprint when OnGrab is triggered but no more succes.

Any idea how to achieve this ?

It sounds like you are trying to prevent an object from falling when it is grabbed and then thrown away, but still allow it to fall and be thrown when it is left on the surface. One way to achieve this is to use the “Set All Physics Linear Velocity” node to set the object’s velocity to 0x0x0 when it is grabbed, and then use the “Set All Physics Linear Velocity” node again to set its velocity to 0x0x0 when it is thrown away. This will effectively “freeze” the object’s velocity when it is grabbed, allowing it to be thrown away without falling, but will still allow it to fall and be thrown when it is left on the surface.

Alternatively, you could use the “Set All Physics Linear Velocity” node to set the object’s velocity to 0x0x0 when it is grabbed, and then use the “Set All Physics Linear Velocity” node again to set its velocity to 0x0x0 when it is thrown away. This will effectively “freeze” the object’s velocity when it is grabbed, allowing it to be thrown away without falling, but will still allow it to fall and be thrown when it is left on the surface.

It’s also worth noting that the “Set All Physics Linear Velocity” node can be used to set the velocity of an object to any value you want, so you could also try setting the object’s velocity to a very small value when it is grabbed, and then to a very large value when it is thrown away. This would effectively “freeze” the object’s velocity when it is grabbed, allowing it to be thrown away without falling, but would still allow it to fall and be thrown when it is left on the surface.

Hope it works!

Hey !

Thanks a lot for the answer ! Based on your answer I think my explanation was not clear. Everything works well when I grab a still object with physics and I throw it away, it’s only when I grab a falling object mid-air that I cannot throw it away like when it was still, it keeps the falling velocity.

I did in fact tried to “Set All Physics Linear Velocity” in the “OnGrab” element but this has no effect on the grabbed object (I certainly did it wrong). Could you maybe provide an exemple ?