Numa Posted May 20, 2016 Share Posted May 20, 2016 Hi there, I'm back Is there a way to detect if a mesh has animations playing and cancel them? I'm using the following code to animate the emissive color of my meshes on mouse over, but it doesn't seem to be pushing the animation to mesh.animations: BABYLON.Animation.CreateAndStartAnimation('fadingIn', objectUnderPointer, "material.emissiveColor", 30, 10, objectUnderPointer.material.emissiveColor, fullEmissive, 0); Also the Animation class doesn't seem to have a stop method so I'm not sure where to go from there. Thanks! Quote Link to comment Share on other sites More sharing options...
eboo Posted May 20, 2016 Share Posted May 20, 2016 maybe you can find something here Quote Link to comment Share on other sites More sharing options...
dbawel Posted May 20, 2016 Share Posted May 20, 2016 @Numa - Perhaps there is a more efficient or function to provide more key info; however you can always mesh.getAbsolutePosition() for any mesh and measure the delta at any time in miliseconds. I know there was a request for mesh.getAbsoluteRotation(), however I don't believe this has been implimented yet. But if any object rotating has a child, you can use mesh.getAbsolutePosition for the child to know if animation is occuring. And if your object is not a skeleton or doesnt have a child, then parent a primitve object to the object which has animation, and set it's visibility to false or 0.0 - depending on which visibility function you use. DB Quote Link to comment Share on other sites More sharing options...
Numa Posted May 24, 2016 Author Share Posted May 24, 2016 Thanks for the suggestion dbawel, but that's assuming the animated property is the position ^^ what if it's the color or something else? Anyway I found a way by going through the scene's animatables, looping through them and searching for the animatable containing an animation with a matching name, then stopping the animatable (not the animation). It seems like a very convoluted way of doing things but hey it works. Also while digging I found the strangest function, what in the 7 gods is Animation.getHighestFrame() ? The doc doesn't say anything, did you mean getLastFrame() as in getFrameWithTheHighestFrameNumber ? Thanks guys. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted May 24, 2016 Share Posted May 24, 2016 Animation.getHighestFrame() was added by me. Probably not that usable in application level code. It is for copying named animation ranges from skeleton to another. If the range in the source skeleton was 1 to 50, but there were already frames up to 500 in the destination skeleton, you would want the copy to go in frames 501 - 550. getHighestFrame() returns 500. Numa 1 Quote Link to comment Share on other sites More sharing options...
Numa Posted May 24, 2016 Author Share Posted May 24, 2016 Oh very good, thank you. 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.