Sign in to follow this  
Knight

Is it possible to load skeletons only (and not mesh)?

Recommended Posts

I have two .babylon files. One with meshes and skeletons, but no animation. The other one has skeletons and animation, but no meshes. Turns out BABYLON.SceneLoader.ImportMesh doesn't load the skeletons at all, because there's no mesh in the file. Is there any way to import .babylon file with just skeletons and animation?

Share this post


Link to post
Share on other sites

You must use createAnimationRange and copyAnimationRange

BABYLON.SceneLoader.ImportMesh("", "http://www.babylon.actifgames.com/anim/", "walk.babylon", scene, function (newMeshesFactice, particleSystems, skeletonsWalk) {

		var meshFactice = newMeshesFactice[0]; // Character lowpoly factice avec anim walk
		BipWalk = skeletonsWalk[0];// skeleton for anim walk		
		BipWalk.createAnimationRange("walk", 0, 40);	
					
		if (BipWalk) {

			meshFactice.position.x = 100;
			meshFactice.dispose();// delete mesh lowpoly factice				
			
			// Import character hightpoly
			BABYLON.SceneLoader.ImportMesh("", "http://www.babylon.actifgames.com/anim/", "man.babylon", scene, function (newMeshesPerso, particleSystems, skeletonsPerso) {

				skeletonsPerso[0].copyAnimationRange(BipWalk, "walk", true);
	  			skeletonsPerso[0].beginAnimation("walk", true, 1.0);
				
			});
		}		
    });	

I did this a while ago. The first importMesh, load the mesh with the animation and I put the movie in createanimationRange
Then the second importMesh, load mesh with Skeleton without animation and I'll get the animation with copyAnimationRange

This loads the animation on the fly

PG exemple: http://www.babylonjs-playground.com/#GA8XI#12

Post here : http://www.html5gamedevs.com/topic/20768-loading-animations-on-the-fly/?do=findComment&comment=119347

 

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.