Ok, so this is just not making any sense to me. I got to make a real game on Unity 4 Free, and I created a ragdoll on the player’s animated bones, and set all their rigidbodies to kinematic. Then, on my health script, when the collision is giving out false and the raycast isn’t hitting anything, all the bones turn non-kinematic and the animation and movement scripts are disabled. That was all working fine, but, for some reason the player’s ragdoll is bugging out completely, having the spine get throttled away and the pelvis and all other bones go to the scene origin (0x, 0y, 0z). I have no idea why is this happening. Following is the part of the health script that has the void that ragdollizes the bones, unchanged from it’s previous state, and attached to the root bone of the rig, just like when it used to work:
public void Fly() {
bone1.isKinematic = false;
bone2.isKinematic = false;
bone3.isKinematic = false;
bone4.isKinematic = false;
bone5.isKinematic = false;
bone6.isKinematic = false;
bone7.isKinematic = false;
bone8.isKinematic = false;
bone9.isKinematic = false;
bone10.isKinematic = false;
bone11.isKinematic = false;
bone1.collider.isTrigger = false;
bone2.collider.isTrigger = false;
bone3.collider.isTrigger = false;
bone4.collider.isTrigger = false;
bone5.collider.isTrigger = false;
bone6.collider.isTrigger = false;
bone7.collider.isTrigger = false;
bone8.collider.isTrigger = false;
bone9.collider.isTrigger = false;
bone10.collider.isTrigger = false;
bone11.collider.isTrigger = false;
transform.parent.animation.enabled = false;
transform.parent.GetComponent<animationSystem> ().enabled = false;
parent.GetComponent<characterMotor> ().enabled = false;
parent.rigidbody.isKinematic = true;
camera.GetComponent<rotateWhenMoving> ().enabled = false;
rigidbody.velocity = parent.rigidbody.velocity;
gameObject.AddComponent<flyingCharacter> ();
GetComponent<flyingCharacter>().getUpAnimation = getUpAnimationName;
GetComponent<flyingCharacter>().getUpAnimLength = getUpAnimLenghtInFrames * 30;
GetComponent<flyingCharacter>().Player = parent;
GetComponent<flyingCharacter>().playerCharacter = this;
GetComponent<flyingCharacter>().reference = facecamFix;
GetComponent<flyingCharacter>().rootBone = gameObject;
GetComponent<flyingCharacter>().maximumDifference = 0.001f;
this.enabled = false;
}
Any help would be highly appreciated. I uploaded a video to YouTube, in case you’d like to see exactly what’s happening.
Link to the video: - YouTube