void OnAnimatorMove() { Animator anim = GetComponent <Animator>(); AnimatorStateInfo stateInfo = anim.GetCurrentAnimatorStateInfo(0); anim.ApplyBuiltinRootMotion(); }
private void OnAnimatorMove() { if (anim != null) { anim.ApplyBuiltinRootMotion(); } }
// OnStateMove is called right after Animator.OnAnimatorMove(). Code that processes and affects root motion should be implemented here override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (!controller.IsAtDeathState()) { player.SetBool("is_dead", true); player.ApplyBuiltinRootMotion(); if (controller.CanAttack()) { //animator.applyRootMotion = false; player.SetBool("on_exit", false); player.SetBool("run_con", true); player.SetBool("run_con2", false); player.SetBool("is_enemy_die", true); player.SetBool("attack_con", false); player.SetBool("can_exit", true); player.SetTrigger("attack"); if (stateInfo.IsName("wait_for_attack")) { if (Time.frameCount % 30 == 0) { controller.Attack(); } } if (controller.IsEnemyDied()) { player.SetBool("is_dead", true); player.SetBool("attack_con", true); player.SetBool("is_enemy_die", false); player.SetBool("on_exit", true); player.SetBool("can_exit", false); } } } }
void OnAnimatorMove() { stateInfo = animator.GetCurrentAnimatorStateInfo(0); if (rootMotionEnabled = !stateInfo.IsTag("DisableRootMotion")) { animator.ApplyBuiltinRootMotion(); } }
void OnAnimatorMove() { stateInfo = anim.GetCurrentAnimatorStateInfo(0); if (stateInfo.fullPathHash == Animator.StringToHash("Base.Grounded.Running")) { anim.ApplyBuiltinRootMotion(); } }
//Podczas cutsceny public void CutScene(GameObject cutScene) { Destroy(cutScene); anim.applyRootMotion = true; Debug.Log("true"); anim.applyRootMotion = false; Debug.Log("false"); anim.ApplyBuiltinRootMotion(); }
private void OnAnimatorMove() { AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(0); if (stateInfo.fullPathHash == Animator.StringToHash("Jumping.Falling.Landing")) { animator.ApplyBuiltinRootMotion(); } }
void OnAnimatorMove() { if (agent != null) { ; // agent.velocity = anim.velocity; } else if (agent == null) { anim.ApplyBuiltinRootMotion(); } }
private void OnAnimatorMove() { if (character.MovementState.HasFlag(MovementState.IsGrounded) && !character.MovementState.HasFlag(MovementState.Forward) && !character.MovementState.HasFlag(MovementState.Backward) && !character.MovementState.HasFlag(MovementState.Left) && !character.MovementState.HasFlag(MovementState.Right)) { animator.ApplyBuiltinRootMotion(); } }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) //{ // //} // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) //{ // //} // OnStateExit is called when a transition ends and the state machine finishes evaluating this state //override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) //{ // //} // OnStateMove is called right after Animator.OnAnimatorMove() override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { SloopHandler mine = animator.gameObject.GetComponent <SloopHandler>(); mine.CalculateForward(); mine.CalculateGroundAngle(); mine.CheckGround(); mine.ApplyGravity(); mine.DrawDebugLines(); animator.ApplyBuiltinRootMotion(); }
void OnAnimatorMove() { state = animator.GetCurrentAnimatorStateInfo(0); if (!state.IsTag("NoMoving")) { animator.ApplyBuiltinRootMotion(); } else //detected animation tagged NoMoving where we don't want animation movement, doesn't apply movement { //Debug.Log("No Moving"); } }
// Callback for processing animation movements for modifying root motion. void OnAnimatorMove() { AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(0); // APPLY DEFAULT ROOT MOTION, ONLY WHEN IN THESE ANIMATION STATES if (stateInfo.IsTag("RootMotion")) { animator.ApplyBuiltinRootMotion(); } else { animator.applyRootMotion = false; } }
override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex){ float normalizedTime_ = Mathf.Clamp( (stateInfo.normalizedTime - _matchMin) / (_matchMax - _matchMin), 0f, 1f); if ( _SnapEnabled && normalizedTime_ > 0 ){ Quaternion snappedRotation_ = Quaternion.Euler(0, targetAngle_, 0); Quaternion targetRotation_ = Quaternion.Lerp(_enterRotation, snappedRotation_, normalizedTime_); animator.transform.position = animator.rootPosition; animator.transform.rotation = targetRotation_; } else { animator.ApplyBuiltinRootMotion(); } }
private void OnAnimatorMove() { _animator.ApplyBuiltinRootMotion(); // if (false == _characterMovement.IsGrounded) // { // Vector3 lMoveDirection = _characterMovement.CalculateTargetDirection(); // Vector3 lMoveVelocity = lMoveDirection * (_jumpMoveSpeed * Time.fixedDeltaTime); // // _rigidbody.velocity = new Vector3( // lMoveVelocity.x + _jumpVelocity.x, // _rigidbody.velocity.y, // lMoveVelocity.z + _jumpVelocity.z); // // if (_animator.GetFloat(AnimatorHash.FallingTime) > 1f) // _jumpVelocity = Vector3.zero; // } }
void OnAnimatorMove() { AnimatorStateInfo stateInfo = anim.GetCurrentAnimatorStateInfo(0); // APPLY DEFAULT ROOT MOTION, ONLY WHEN IN THESE ANIMATION STATES if (stateInfo.IsName("Turn") || stateInfo.IsName("TurnRunning")) { anim.ApplyBuiltinRootMotion(); } // if (animator) // { // Vector3 newPosition = transform.position; // newPosition.x += animator.GetFloat("Runspeed") * Time.deltaTime; // transform.position = newPosition; // } }
public void OnAnimatorMove() { if (Animator == null) { return; } Animator.ApplyBuiltinRootMotion(); // we implement this function to override the default root motion. // this allows us to modify the positional speed before it's applied. if (_isGrounded && Time.deltaTime > 0) { Vector3 v = (Animator.deltaPosition * MoveSpeedMultiplier) / Time.deltaTime; // we preserve the existing y part of the current velocity. v.y = Body.velocity.y; Body.velocity = v; } }
// OnStateMove is called right after Animator.OnAnimatorMove() override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { // ( vvvv Maybe deleting this could solve the bug? if (useRootMotion /* && stateInfo.shortNameHash == currentStateHash*/) { animator.ApplyBuiltinRootMotion(); //animator.deltaPosition; } float stateWeight = GetWeight(animator, stateInfo, layerIndex); // Apply constant movement motor.Move(animator.transform.rotation * constantMovement * stateWeight * Time.deltaTime); //motor.Move(animator.transform.rotation * constantMovement * (1f - character.movementMultiplier) * Time.deltaTime); }
void OnAnimatorMove() { transform.position = agent.nextPosition; anim.ApplyBuiltinRootMotion(); }
// OnStateMove is called before OnStateMove is called on any state inside this state machine override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { base.OnStateMove(animator, stateInfo, layerIndex); animator.ApplyBuiltinRootMotion(); //Debug.Log (stateInfo.fullPathHash); }
void OnAnimatorMove() { mAnimator.ApplyBuiltinRootMotion(); }
private void OnAnimatorMove() { animator.ApplyBuiltinRootMotion(); }