Question by
Aprimez · Jul 02, 2017 at 09:02 AM ·
animations
Unity3D transition animation playing twice
I've got the following code:
void Update ()
{
firstPersonVector3 = firstPersonController.GetComponent<Transform> ().position;
float distanceVector3 = Vector3.Distance (transformAttacker.position, firstPersonVector3);
if (distanceVector3 > 15) {
navMeshAgent.speed = 7;
killer ("Run");
} else if (distanceVector3 > 2.3f){
navMeshAgent.speed = 3.5f;
killer ("Walk");
} else if (distanceVector3 < 2.3f) {
killer ("Crouch");
Debug.Log ("crouch" + distanceVector3);
} ;
}
I did have the walk in an else, which makes me the most sense to me, but I fiddled around with it since it wasn't worked - just in case. Ended up not fixing anything.
I've got transition, which go from one animation to the other. When they're turned off, there's no jittering.
With the animation's transitions turned on, that's when the issue occurs. I believe it's trying to fire the same code whilst the transitions happening causing the transition animation to repeat.
Either way, even if that's not the case. Here's a url to play the project. It's basically something I whipped together merging everything I've learnt in the past few days, into one file. Not an actual game I'm going to use.
Comment