- Home /
OnAnimatorMove never paused.
Hello,
I pause my game like this:
Time.fixedDeltaTime = 0.0F;
Time.timeScale = 0.0F;
Afterwards the OnAnimatorMove method is still called causing this exception:
navmeshagent.velocity assign attempt for 'MyGameObject' is not valid. Input velocity is { NaN, NaN, NaN }.
The callback:
private void OnAnimatorMove() {
this.agent.velocity = this.animator.deltaPosition / Time.deltaTime;
this.transform.rotation = this.animator.rootRotation;
}
Does somebody know how to avoid this happening?
Is Time.deltaTime zero ? If it is, then you are dividing with zero which is infinite.
Ah well, thanks. By checking this, I can avoid the exception. Still wondering why the method is called anyways when timeScale is zero.
$$anonymous$$ay I ask a question ? Why are you dividing with Time.deltaTime ? I use multiplying in my projects. so if zero. velocity is zero, plus dividing is more expensive.
Well, it's physics. That's just how you compute velocity v = s / t. In your project you probably computing v * t = s.
Your answer
Follow this Question
Related Questions
Root Motion and Navmesh Agent 0 Answers
Animation driven NavMeshAgent with Speed, AngularSpeed and Direction as parameters. 1 Answer
Animator component prevents NavMeshAgent from disabling/enabling dynamically 0 Answers
What is the difference between configuration of agent in 'Agents' tab and in 'Bake' tab Unity? 1 Answer
How can I move my player to the front of an object? 2 Answers