- Home /
Character Joints and Animations results in strange physic animation
Hi there
I am trying to first run an animation on my soldier and afterwards let him "die" by using the character joints and rigidbodies.
During the animation, I set the isKinematic value of my most upper rigidbody parant (same script with animation component attached) to true.
After the die function is executed, I first stop the animation, set all velocity and angularVelocity of the child rigidbodies to Vector3.zero and set the isKinematic value of my most upper rigidbody parant to false.
This results in strange physics animation as you can see below.
Does anyone have an idea, what am I doing wrong?
Thanks for your help!
Script attached to the parent object of the most upper rigidbody:
GetComponent<Collider>().enabled = false;
navAgent.enabled = false;
transform.GetChild(0).GetComponent<Animation>().enabled = false;
Rigidbody[] childRigid = GetComponentsInChildren<Rigidbody>();
foreach (Rigidbody rigids in childRigid)
{
rigids.velocity = Vector3.zero;
rigids.angularVelocity = Vector3.zero;
}
transform.GetChild(0).GetComponent<Rigidbody>().isKinematic = false;
Answer by merlinwoff · May 03, 2019 at 02:11 PM
can't nobody think of a reason, why this is happening?
Any answer is appreciated.