How to make the heavy bag move realistically with my punches?

https://streamable.com/vxz6uv
I’m making a punching bag system with realistic bag physics when punched. Hence I tried using a bag model with a rope constraint hoping to achieve this effect when the bag is punched. I approached this by solely relying on the punching animations in the hopes that the punch would move the bag when it connects with the bag because that worked theorectically in my mind, but as you can see in the clip, my attempt is just DEAD.

I want to achieve this realistic bag reaction when punched as seen in the clip below:
https://streamable.com/dz6v70

How can I achieve this? With body movers? Or?

1 Like

Don’t rely on the actual hand collisions, in fact make the arms not collide with the punching bag first.

Then use BodyThrust (add it to the punching bag part).
Then use the BodyThrust.Location: set it to the location where the player punches the bag.

So to get the punch location, you could do it like this:

On the hands: enable and connect to the touch event: so make the arms to NOT collide but DO enable touch.

Then you’d need to get the hand velocity (by storing the previous and current frame position of the hand), so Velocity = HandCurrentFramePos - HandPrevFramePos. This must run each frame.

Then on the touch event: set the BodyThrust.Location: based on the location position and set the Force of the thrust object to the Velocity.Unit * Some_Force_Factor.

2 Likes

By storing the previous position of the hand, do you mean before the punch is thrown? And after position refers to when to hand connects with the bag?
If this has to run every frame, would I have to use the heartbeat event?

What does the location position refer to?

Correct.

The “based on the location position” refers to the hand position when the OnTouch event fires.

TLDR version is this:

  1. You need a “position where the hand impacts the boxing bag” so that you know WHERE to apply the force to so that the pucnhing bag will move physicaly correct.
  2. You need the “velocity” of the hand to know IN WHICH DIRECTION to apply the force: more accurately, you need the direction of the velocity (that is why velocity.Unit is used).
1 Like

Ah okay. Would I have to use runservice.heartbeat function for this? Since it has to run every frame, presumably after the physics is calculated.

Well both would work, either stepped or heartbeat because if you do it before physics then the force will be applied the same frame, but IMO it won’t be visible anyway with just 1 frame delay.