Hi Everyone,
I’m using AddForce with Impulse mode on a ragdoll (using PuppetMaster) by initiating the ragdoll and then applying a force for one step in FixedUpdate by using a boolean (addForce).
void FixedUpdate()
{
if(addForce)
{
hit_RB.AddForce(forceDirection * hitForce, ForceMode.Impulse);
addForce = false;
}
}
I’m not sure if this is the right way to use AddForce with Impulse but it only seems to work in FixedUpdate and it continuously adds force if I don’t use a boolean to turn it off after.
This works perfectly for all but one occasion where I want to add force. This is when a character falls backward off a ledge. I make the character ragdoll and want to apply a bit of backward force but it completely ignores the force. As the force is on a ragdoll and is called the same way as other ragdoll scenarios I can’t work out why it doesn’t work on this one occasion. If I remove the line “addForce = false;” then it does add the force in this scenario (albeit every fixed step which is obviously not what I want).
So my question is a) am I even using AddForce properly, and b) is there a reason why it won’t work when only being called in a single step in one scenario even though it correctly adds force in a single step in other scenarios?
PS - I can confirm that the scenario where it doesn’t work, I’ve not got the rigidbody set to isKinematic and I’m not manually applying velocity to the rigidbody. I also tried switching ForceMode to VelocityChange and Force but still having the same issue.
Thanks in advance for any help or guidance here!