hit2501 Posted April 13, 2018 Share Posted April 13, 2018 Its me again I can play animation of an imported model with: new BABYLON.PlayAnimationAction(BABYLON.ActionManager.NothingTrigger, MESH_NAME, 0, FINAL_FRAME, 0), But this only works if I know the number of frames to put it as "FINAL_FRAME", now, I need to know if an imported model contains an animation (1) or not (0) and if it contains animation to know how many frames it haves. Is this possible? How can I make it? Gracias. Quote Link to comment Share on other sites More sharing options...
Snouto Posted April 13, 2018 Share Posted April 13, 2018 Someone can probably confirm this but as I understand it, you can check the imported mesh's animations array property. If it's null or length==0, you don't have an animation. Something like: if( MESH_NAME.animations && MESH_NAME.animations.length > 0 ) // you've got an animation Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted April 13, 2018 Share Posted April 13, 2018 Though it seems a little insane to be checking this at run time, it would work. Better to just check the export log file. Coming from Blender, there can be more than one blender action exported for a mesh. They will all be in the animations property. Blender also exports BABYLON.AnimationRanges. These hold the start-stop frames of each Blender action. That solves you needing to know which frames anything is in. You just start the range by name: mesh.beginAnimation("Action", true); Note: When more than one object in the .blend has actions, you must give names to the actions in the format 'objectname-action' so the exporter can figure out which action goes to which object. Blender actions are not owned by a specific mesh in their API. Quote Link to comment Share on other sites More sharing options...
hit2501 Posted April 13, 2018 Author Share Posted April 13, 2018 Thank you both, I'll make tests with your suggestions and back here. 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.