- Home /
Play an animation after entering a set distance won't work.
So I want to have my model perform an animation after a set distance, and then play a different animation once you get even closer.
This code isnt working. It will run the 2nd if statement (Walking animation) , but won't run the 1st one (Attacking animation).And don't worry about the variables, there set properly.
if (Distance < Attack)
{
animation.Play("Attacking");
}
if (Distance < Encounter){
animation.Play("Walking");
}
Answer by smallbit · Jul 29, 2014 at 01:40 AM
If(Distance<Encounter && Distance>Attack)
In the second if, since if the distance is less then attack, is also less then encounter, hence it will always trigger second if, do a test and put second if above the first, it will work too :)
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
How can i animate my Object? (bones available) 1 Answer
Animation clips problem 0 Answers
Quick animation question 1 Answer
Blender animations moves my object 4 Answers