Sign in to follow this  
hit2501

PlayAnimationAction with a imported mesh

Recommended Posts

Hi.

 

I  imported a cube with a simple no bones animation (growth) from Blender to Babylon. Looks good with:

BABYLON.SceneLoader.ImportMesh("", "babylon/", "cube.babylon", scene, function (newMeshes) {      var C1 = newMeshes[0];      scene.beginAnimation(C1, 0, 100, false, 1.0);      camera.target = C1; }

but when I want the animation start when I click on the cube nothing happens, this is the code I use:

     	BABYLON.SceneLoader.ImportMesh("", "babylon/", "cube.babylon", scene, function (newMeshes) {     		var C1 = newMeshes[0];                C1.actionManager = new BABYLON.ActionManager(scene);                var action = new BABYLON.PlayAnimationAction(BABYLON.ActionManager.OnPickTrigger, C1, 0, 100, 0);                C1.actionManager.registerAction(action);    		camera.target = C1;	}

 

 

Share this post


Link to post
Share on other sites

FileLoader is organized primarily to load things in batches by type:   materials, lights, meshes, animations, etc. 

 

ImportMesh also does materials of the mesh, children meshes, particle systems, and skeletons.  Maybe it could be made to do animations as well.  I touched this file once, but changed were undone due to behavior changes.  Reconstituting scenes is very order dependent.  I would not mess with this file again.

 

If you have multiple .babylon files, Append instead of Load may get you through.  It does the same thing as Load, but instead of passing an engine,  you pass a scene you create yourself. You then get your animation, and can still append stuff from another .babylon.

Share this post


Link to post
Share on other sites
On 2/19/2015 at 3:08 AM, hit2501 said:

Thanks Deltakosh, but still did not work, I modified my files to use my code in a


BABYLON.SceneLoader.Load 

and it worked. I wonder why it does not work when importing meshes instead of loading.

 

On 2/19/2015 at 3:08 AM, hit2501 said:

Thanks Deltakosh, but still did not work, I modified my files to use my code in a


BABYLON.SceneLoader.Load 

and it worked. I wonder why it does not work when importing meshes instead of loading.

hi,you said use 'SceneLoader.Load',but how can you get the imported mesh?

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.