Why is my ragdoll reacting differently depending on the framerate?

60 FPS reaction:


30 FPS reaction: (This is what I want to happen)


What’s happening:

I’m shooting an object using “AddRelativeForce” with the “VelocityChange” force mode. When the object hits a bone of the character, it disables his “Animator” component and adds force to the bone’s rigidbody.

The problem:

When the game is running at a high framerate the reaction to the collision becomes very weird.

So, how do I get more consistent results independently of the framerate?

Well, I would have to see your code to know for sure, but my best guess is that you are applying physics in the Update() function instead of FixedUpdate(). You should always run physics in FixedUpdate() as it get’s called (by default) every 0.02 seconds, regardless of framerate. Update()gets called every frame.

So if you have any physics in an Update() function, move it to FixedUpdate().

Well, I’m still not sure what exactly was happening there but, the solution that I found was to set the “IsKinematic” property of the bones’ Rigidbody on or off whenever I activate or deactivate the Ragdoll. Now the collision reaction seems correct and consistent.