void Awake() { if (CheckForControllerError()) { return; } ragdollOnCollision.InitializeRagdollOnCollisions(this); animator = GetComponent <Animator>(); // store original culling mode originalAnimatorCullingMode = animator.cullingMode; // store master hip bone masterHips = animator.GetBoneTransform(HumanBodyBones.Hips); // get all the master renderers to switch off when going ragdoll masterRenderers = GetComponentsInChildren <Renderer>(); // set the ragdolls follow target (assumes same bone setup...) ragdoll.SetFollowTarget(animator); // tell the ragdoll it's being controlled ragdoll.SetController(this); // initialize animation following InitializeJointFollowing(); InitializeVelocitySetValues(); GetUpImmediate(false); //subscribe to receive a callback on ragdoll bone collision ragdoll.onCollisionEnter += OnRagdollCollisionEnter; }
void Awake() { if (!profile) { Debug.LogWarning("No Controller Profile on " + name); return; } if (!ragdoll) { Debug.LogWarning("No Ragdoll for " + name + " to control..."); return; } eventPlayer = GetComponent <AssetObjectsPacks.EventPlayer>(); eventPlayer.AddParameter(new AssetObjectsPacks.CustomParameter("OnFront", false)); animator = GetComponent <Animator>(); // store original culling mode originalAnimatorCullingMode = animator.cullingMode; // store master hip bone masterHips = animator.GetBoneTransform(HumanBodyBones.Hips); // get all the master renderers to switch off when going ragdoll masterRenderers = GetComponentsInChildren <Renderer>(); // set the ragdolls follow target (assumes same bone setup...) ragdoll.SetFollowTarget(animator); // tell the ragdoll it's being controlled ragdoll.SetController(this); // initialize animation following InitializeJointFollowing(); InitializeVelocitySetValues(); // disable physics ragdoll.UseGravity(false); //ragdoll.OverrideDepenetrationSpeed(-1); ragdoll.IgnoreSelfCollisions(true); ResetToAnimated(); ResetBoneDecays(); //subscribe to receive a callback on ragdoll bone collision ragdoll.onCollisionEnter += OnRagdollCollisionEnter; }