Example #1
0
 public void CopyFromChrAsm(NewChrAsm chrAsm)
 {
     GameType                    = GameDataManager.GameType;
     HeadID                      = chrAsm.HeadID;
     BodyID                      = chrAsm.BodyID;
     ArmsID                      = chrAsm.ArmsID;
     LegsID                      = chrAsm.LegsID;
     RightWeaponID               = chrAsm.RightWeaponID;
     RightWeaponModelIndex       = chrAsm.RightWeaponModelIndex;
     LeftWeaponID                = chrAsm.LeftWeaponID;
     LeftWeaponModelIndex        = chrAsm.LeftWeaponModelIndex;
     LeftWeaponFlipBackwards     = chrAsm.LeftWeaponFlipBackwards;
     LeftWeaponFlipSideways      = chrAsm.LeftWeaponFlipSideways;
     RightWeaponFlipBackwards    = chrAsm.RightWeaponFlipBackwards;
     RightWeaponFlipSideways     = chrAsm.RightWeaponFlipSideways;
     DS3RightWeaponAbsorpPosType = chrAsm.DS3RightWeaponAbsorpPosType;
     DS3LeftWeaponAbsorpPosType  = chrAsm.DS3LeftWeaponAbsorpPosType;
 }
Example #2
0
        public void UpdateWeaponTransforms()
        {
            if (RightWeaponModel != null)
            {
                Matrix absoluteWeaponTransform = Matrix.Identity;

                if (RightWeaponAbsorpPosParam != null)
                {
                    if (DS3RightWeaponAbsorpPosType == 0)
                    {
                        DS3RightWeaponAbsorpPosType = ParamData.WepAbsorpPosParam.WepAbsorpPosType.OneHand0;
                    }

                    var wepAbsorpPos = MODEL.DummyPolyMan.GetDummyPolyAbsolutePosition(
                        RightWeaponAbsorpPosParam.AbsorpPos[DS3RightWeaponAbsorpPosType],
                        leftHandDefault: false) ?? Vector3.Zero;

                    absoluteWeaponTransform = Matrix.CreateFromQuaternion(
                        Quaternion.Normalize(Quaternion.CreateFromRotationMatrix(
                                                 Skeleton.FlverSkeleton[RightWeaponBoneIndex].ReferenceMatrix
                                                 * Skeleton[RightWeaponBoneIndex]))) * Matrix.CreateTranslation(wepAbsorpPos);
                }
                else
                {
                    absoluteWeaponTransform =
                        Skeleton.FlverSkeleton[RightWeaponBoneIndex].ReferenceMatrix
                        * Skeleton[RightWeaponBoneIndex];
                }

                RightWeaponModel.StartTransform = new Transform(
                    (RightWeaponFlipBackwards ? Matrix.CreateRotationX(MathHelper.Pi) : Matrix.Identity)
                    * (RightWeaponFlipSideways ? Matrix.CreateRotationY(MathHelper.Pi) : Matrix.Identity)
                    * absoluteWeaponTransform
                    * MODEL.AnimContainer.CurrentAnimRootMotionMatrix);
            }

            if (LeftWeaponModel != null)
            {
                Matrix absoluteWeaponTransform = Matrix.Identity;

                if (LeftWeaponAbsorpPosParam != null)
                {
                    if (DS3LeftWeaponAbsorpPosType == 0)
                    {
                        DS3LeftWeaponAbsorpPosType = ParamData.WepAbsorpPosParam.WepAbsorpPosType.OneHand1;
                    }

                    var wepAbsorpPos = MODEL.DummyPolyMan.GetDummyPolyAbsolutePosition(
                        LeftWeaponAbsorpPosParam.AbsorpPos[DS3LeftWeaponAbsorpPosType],
                        leftHandDefault: false) ?? Vector3.Zero;

                    absoluteWeaponTransform = Matrix.CreateFromQuaternion(
                        Quaternion.Normalize(Quaternion.CreateFromRotationMatrix(
                                                 Skeleton.FlverSkeleton[LeftWeaponBoneIndex].ReferenceMatrix
                                                 * Skeleton[LeftWeaponBoneIndex]))) * Matrix.CreateTranslation(wepAbsorpPos);
                }
                else
                {
                    absoluteWeaponTransform =
                        Skeleton.FlverSkeleton[LeftWeaponBoneIndex].ReferenceMatrix
                        * Skeleton[LeftWeaponBoneIndex];
                }

                LeftWeaponModel.StartTransform = new Transform(
                    (LeftWeaponFlipBackwards ? Matrix.CreateRotationX(MathHelper.Pi) : Matrix.Identity)
                    * (LeftWeaponFlipSideways ? Matrix.CreateRotationY(MathHelper.Pi) : Matrix.Identity)
                    * absoluteWeaponTransform
                    * MODEL.AnimContainer.CurrentAnimRootMotionMatrix);
            }
        }