- Home /
Adding force to ragdoll after isKinematic is disabled?
I have an enemy with a basic ragdoll set up. Except instead of instantiating the ragdoll, I just have all the bone colliders on the character at all times and I just set them all to false when its killed by a raycast projectile:
if (enemyDead == true) {
for(int i = 0; i < rigidbodies.Length; i++){
rigidbodies[i].isKinematic = false;
rigidbodies[i].WakeUp();
}
My raycast projectile is scripted to add force to rigidbodies:
AddForceAtPosition(ray.direction * Force, hit.point);
But the enemy will just crumple in place when the ragdoll is activated. I'm assuming it's because the force from the raycast is applied before the enemy's ragdoll is set to isKinematic = false. So how do I "save" that add force at the hit.point and then re-apply it to the newly non-kinematic ragdoll? Or is there a better way to do it?
Answer by SpaceManDan · Apr 14, 2016 at 11:13 PM
The force needs to be applied after isKinematic is set to false.
That code should work if in that order.
Your answer
![](https://koobas.hobune.stream/wayback/20220613185040im_/https://answers.unity.com/themes/thub/images/avi.jpg)