How to call 'Animator.Play' without wait for FixedUpdate?
Hello
I have a function that makes a character shoot projectiles after making sure that 'aiming' pose is completed.
....
But in some causes I don't want to wait for the transition to finish Sometimes I need the pose to happen immediately.
So I used 'Animator.Play ("Aim")' before shooting any projectile because I want to make sure he is aiming to the right direction.
.-
But i found that unity wasn't play the animation immediately he just sent a request to the Animator And this takes a few seconds maybe (0.00001) until pose animation happen.
........
And this cause the projectiles to move into the wrong direction because the fire function is called next to 'Animation.Play' directly.. Any way to solve this? I tried using IEnumerator and 'WaitForFixedUpdate' method and it's working, But i want to set the pose 'immediately' in the same frame without waiting for fixedupdate.
public Animator anim;
public Rigidbody projectile;
void Shoot () {
anim.Play ("Aim");
//the aim pose should be completed here
projectile.velocity = new Vector3 (10, 0, 0);
}