Esempio n. 1
0
        public void AfterAnimUpdate()
        {
            CurrentRootMotionTransform = new Transform(AnimContainer?.CurrentAnimRootMotionMatrix ?? Matrix.Identity);

            CurrentTransform = new Transform(StartTransform.WorldMatrix *
                                             AnimContainer?.CurrentAnimRootMotionMatrix ?? Matrix.Identity);

            if (ChrAsm != null)
            {
                ChrAsm.UpdateWeaponTransforms();
                ChrAsm.UpdateWeaponAnimation();
            }

            DummyPolyMan.UpdateAllHitPrims();

            if (ChrAsm != null)
            {
                if (ChrAsm.RightWeaponModel != null)
                {
                    ChrAsm.RightWeaponModel.DummyPolyMan.UpdateAllHitPrims();
                }

                if (ChrAsm.LeftWeaponModel != null)
                {
                    ChrAsm.LeftWeaponModel.DummyPolyMan.UpdateAllHitPrims();
                }
            }
        }
Esempio n. 2
0
        public void AfterAnimUpdate(float timeDelta, bool ignorePosWrap = false)
        {
            if (AnimContainer?.EnableRootMotion == false)
            {
                CurrentDirection             = 0;
                CurrentRootMotionTranslation = Matrix.Identity;
            }

            var newTransform = new Transform(StartTransform.WorldMatrix * CurrentRootMotionRotation * CurrentRootMotionTranslation);



            // TEST: modulo world pos
            Vector3 locationWithNewTransform = Vector3.Transform(Vector3.Zero, newTransform.WorldMatrix);

            if (!ignorePosWrap && AnimContainer?.EnableRootMotionWrap == true && (locationWithNewTransform.LengthSquared() > 100))
            {
                Vector3 locationWithNewTransform_Mod = new Vector3(locationWithNewTransform.X % 1, locationWithNewTransform.Y, locationWithNewTransform.Z % 1);
                Vector3 translationDeltaToGetToMod   = locationWithNewTransform_Mod - locationWithNewTransform;
                CurrentRootMotionTranslation *= Matrix.CreateTranslation(translationDeltaToGetToMod);

                OnRootMotionWrap?.Invoke(translationDeltaToGetToMod);
            }


            //newTransform = new Transform(newTransform.WorldMatrix * );
            ////////

            CurrentTransform = new Transform(StartTransform.WorldMatrix * CurrentRootMotionRotation * CurrentRootMotionTranslation);

            if (ChrAsm != null)
            {
                ChrAsm.UpdateWeaponTransforms(timeDelta);
                ChrAsm.UpdateWeaponAnimation(timeDelta);
            }

            DummyPolyMan.UpdateAllHitPrims();

            if (ChrAsm != null)
            {
                ChrAsm.RightWeaponModel0?.DummyPolyMan.UpdateAllHitPrims();
                ChrAsm.RightWeaponModel1?.DummyPolyMan.UpdateAllHitPrims();
                ChrAsm.RightWeaponModel2?.DummyPolyMan.UpdateAllHitPrims();
                ChrAsm.RightWeaponModel3?.DummyPolyMan.UpdateAllHitPrims();
                ChrAsm.LeftWeaponModel0?.DummyPolyMan.UpdateAllHitPrims();
                ChrAsm.LeftWeaponModel1?.DummyPolyMan.UpdateAllHitPrims();
                ChrAsm.LeftWeaponModel2?.DummyPolyMan.UpdateAllHitPrims();
                ChrAsm.LeftWeaponModel3?.DummyPolyMan.UpdateAllHitPrims();
            }
        }