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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.