Question by
hotozi · Aug 30, 2017 at 05:51 PM ·
animationscripting problemanimatoranimator controller
Animator Check the end of an animation
I have this simple code here... the Var doesn't switch at the end of the animation... i even set the animtion Loop Off and On still doesnt work
var LandPhase=true;
function Update(){
BodyAnim=TheBody.GetComponent.<Animator>();
if(!LandPhase){BodyAnim.Play('jump_20_c');LandPhase=true;}¨
if(LandPhase&&!BodyAnim.GetCurrentAnimatorStateInfo(0).IsName("jump_20_c")){LandPhase=false;}¨
}
And this too....
var LandPhase=true;
function Update(){
BodyAnim=TheBody.GetComponent.<Animator>();
if(!LandPhase){BodyAnim.Play('jump_20_c');LandPhase=true;}¨
if(LandPhase&&BodyAnim.GetCurrentAnimatorStateInfo(0).IsName("jump_20_c")){LandPhase=false;}¨
}
Comment
Best Answer
Answer by hotozi · Sep 01, 2017 at 06:18 PM
Never mind i found the solution
GetCurrentAnimatorStateInfo(0).normalizedTime > 0.99f
//normalizedTime = is equal to the animation frame
Thats the script we should use
Your answer
Follow this Question
Related Questions
Using same animator for multiple game objects 0 Answers
Confused about animations 1 Answer
Animator is not firing transitions. 0 Answers
NEED HELP ANIMATING PLAYER MOVEMENT 0 Answers
Animator vs Animation Clip via Scripting 0 Answers