eboo Posted April 10, 2016 Share Posted April 10, 2016 i'm in trouble with a so stupid think that ... i m confused but i'm moving mesh from A to B i launch animation (skeleton1.beginAnimation("marcher");) all is ok, my renderloop is ok ... but... if B is too far ... i'd like to make a loop. How can i detect the end of the animation. I could try to use time to lanch animation ... but i d like to be able to switch animations (walk / run / use a horse / etc ) 2 quesitons: - is there a "skeleton1" parameter to detect "running " animation? - or is there a way to loop animations (until i decide to stop :p) Quote Link to comment Share on other sites More sharing options...
Dad72 Posted April 10, 2016 Share Posted April 10, 2016 I think you can use the intersect of Babylon. for example, a box that you make invisible and can with intersect trigger an event that gives you the end of an animation (your point B): Documentation on intersect here: http://doc.babylonjs.com/tutorials/Intersect_Collisions_-_mesh Quote Link to comment Share on other sites More sharing options...
Temechon Posted April 10, 2016 Share Posted April 10, 2016 You can use this parameter : http://doc.babylonjs.com/classes/2.2/Animatable#onanimationend-any It's a function called when the animation is finished. Here is an example : http://www.babylonjs-playground.com/#1JYOZX#2 Here are some more examples : http://doc.babylonjs.com/playground?q=onanimationend Virax and GameMonetize 2 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 10, 2016 Share Posted April 10, 2016 Hello, beginAnimation has all you need (check the loop parameter and the onAnimationEnd callback): http://doc.babylonjs.com/classes/2.3/Scene#beginanimation-target-from-to-loop-speedratio-onanimationend-animatable-rarr-animatable-classes-2-3-animatable- JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
eboo Posted April 10, 2016 Author Share Posted April 10, 2016 thks guys Quote Link to comment Share on other sites More sharing options...
eboo Posted April 17, 2016 Author Share Posted April 17, 2016 i ve lost so many time playing with this point.... here is the (so) simple solution... RTFM eboo! http://doc.babylonjs.com/classes/2.3/Skeleton skeleton1.beginAnimation("marcher",true); "true" make skeleton animation loop GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.