예제 #1
0
    public void switchToAnimation()
    {
        if (isRagdollMode)
        {
            act.tfObservedCenter = tfBodyHeadCenter;

            var tfWapon = act.playerShoot.weapons.current.tf;

            tfWapon.parent = tfBodyHand;

            tfWapon.localPosition = Vector3.zero;

            tfWapon.localRotation = Quaternion.identity;



            tfRagdollBase.gameObject.SetActive(false);

            tfBodyBase.gameObject.SetActive(true);

            act.activateCollider(true);

            act.rb.isKinematic = false;

            smr.switchBones(tfBodyParts);


            act.rb.MovePosition(tfRagdollBase.position - act.tfBody.localPosition);

            act.rb.MoveRotation(Quaternion.LookRotation(act.rb.rotation * Vector3.forward, Vector3.up));


            RagdollCliper.clipPose(tfRagdollBase, msRagdoll.clip);

            act.playMotion(msRagdoll);

            /*
             * for( var i = 1; i < tfBodyParts.Length; i++ )
             * {
             *
             *      var tfBodyPart = tfBodyParts[i];
             *
             *      var tfRagdollPart = tfRagdollParts[i];
             *
             *      tfBodyPart.localPosition = tfRagdollPart.localPosition;
             *
             *      tfBodyPart.localRotation = tfRagdollPart.localRotation;
             *
             * }
             *
             * tfBodyBase.position = tfRagdollBase.position;
             *
             * tfBodyBase.rotation = tfRagdollBase.rotation;
             *
             *
             * //act.playMotion( ragMotion.getNowPosing() );
             *
             * //switchObservedCenter();
             */
        }
    }