// Updates every frame but after Update() and should be used for things that happen based on the effects caused by actions in the Update()
    void LateUpdate()
    {
        if (controller != null){

            //AnimationStateMachine asm = GetASM();
            result = asm.GetRootMotion();

            if( result != null ) {
                // apply gravity if not attempting to jump
                // create an internal function to sort through and categorize states and destinations as strings or values
                // then call the function to decide if gravity or any other type of movement should be allowed based on the
                // current or coming states.
                if (asm.GetCurrentDestinationState() != "jump" & asm.GetCurrentState() != "jump")
                    gravity = true;
                else
                    gravity = false;

                // simulate gravity
                Vector3 grav = (Vector3.up * -9.8f * Time.deltaTime );

                //move the controller based on gravity and the RMC
                controller.Move(( gravity ? grav : Vector3.zero ) + result.GlobalTranslation);
            }
        }
    }
Example #2
0
    // Updates every frame but after Update() and should be used for things that happen based on the effects caused by actions in the Update()
    void LateUpdate()
    {
        if (controller != null)
        {
            //AnimationStateMachine asm = GetASM();
            result = asm.GetRootMotion();

            if (result != null)
            {
                // apply gravity if not attempting to jump
                // create an internal function to sort through and categorize states and destinations as strings or values
                // then call the function to decide if gravity or any other type of movement should be allowed based on the
                // current or coming states.
                if (asm.GetCurrentDestinationState() != "jump" & asm.GetCurrentState() != "jump")
                {
                    gravity = true;
                }
                else
                {
                    gravity = false;
                }

                // simulate gravity
                Vector3 grav = (Vector3.up * -9.8f * Time.deltaTime);

                //move the controller based on gravity and the RMC
                controller.Move((gravity ? grav : Vector3.zero) + result.GlobalTranslation);
            }
        }
    }
Example #3
0
 void LateUpdate()
 {
     if (controller != null)
     {
         result = asm.GetRootMotion();
         if (result != null)
         {
             controller.Move((moveDirection * Time.deltaTime) + result.GlobalTranslation);
         }
     }
 }
Example #4
0
 // Updates every frame but after Update() and should be used for things that happen based on the effects caused by actions in the Update()
 void LateUpdate()
 {
     if (controller != null){
     //AnimationStateMachine asm = GetASM();
         result = asm.GetRootMotion();
         if( result != null ) {
             // apply gravity
             Vector3 gravity = (Vector3.up * -9.8f * Time.deltaTime );
             controller.Move((moveDirection * Time.deltaTime) + gravity + result.GlobalTranslation);
         }
     }
 }
Example #5
0
 // Updates every frame but after Update() and should be used for things that happen based on the effects caused by actions in the Update()
 void LateUpdate()
 {
     if (controller != null)
     {
         //AnimationStateMachine asm = GetASM();
         result = asm.GetRootMotion();
         if (result != null)
         {
             // apply gravity
             Vector3 gravity = (Vector3.up * -9.8f * Time.deltaTime);
             controller.Move((moveDirection * Time.deltaTime) + gravity + result.GlobalTranslation);
         }
     }
 }