- Home /
How to re-center a Rigidbody isKinematic object after adding force to it?
I've been stuck on a small problem which might have a simple solution but seems to escape me: I am using AddForce to move a character that has a Rigidbody with isKinematic set to true (it's a ragdoll character). With isKinematic set to true, the transform property of the character doesn't update as the character is pushed around, and therefore I can't keep track of its position. I need to know its position to calculate its distance to targets, etc. Does anyone know the best solution around this? Thank you!
Answer by wyatts · Jul 09, 2021 at 04:36 AM
As far as I know Kinematic bodies aren't supposed to react to forces. Is this potentially an issue with parent/child objects and multiple rigidbodies?
Answer by vtimofee · Jul 09, 2021 at 04:25 PM
Thanks for your reply @wyatts! I got a little confused when toggling my Ragdoll on and off. When Ragdoll mode is on, the parent's Rigidbody isKinematic property is set to true, its Box Collider is set to false, and on all of the children (the limbs), the Rigidbody isKinematic prop is set to false and its colliders to true. There must be a better solution to this but I ended up using the Rigidbody.worldCenterofMass property of the pelvis, to track the position of the Ragdoll around game space when pushing it around using AddForce, (the pelvis' transform properties also didn't update).
This answer goes into some detail about transforms and world space. In short you should be able to use transform.position.
Your answer
Follow this Question
Related Questions
Get result (force & torque) of AddForceAtPosition? 2 Answers
Why is force only being added in the same direction? 1 Answer
How do I add force To rigidbody based On Character's Walking direction? 0 Answers
Prevent Rigidbody From Rotating 3 Answers
Erratic Physics behaviour while testing in 2 computers 0 Answers