Bugging ragdoll
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: https://youtu.be/pKGV_4rVLho
Answer by AlphaGarg8447 · Nov 29, 2015 at 08:33 PM
Solved the problem. Apparently all bones jointed to the root bone had disconnected (LeftUpLeg, RightUpLeg and Spine1), and because of that that weird thing was happening.
Your answer
Follow this Question
Related Questions
Ragdoll won't recieve damage from raycast gun, or allow move code, or deactivate 0 Answers
How can I move an object in the direction another object is facing. 1 Answer
Rigid Body and Collision 1 Answer
Problem. Pick up and Grab object script, except all objects in scene are picked up instead of one. 0 Answers
Ray cast to object to transform, instead all objects with script transform. 0 Answers