Jump to content

How to import only armature/skeleton


kevzettler
 Share

Recommended Posts

I have an animated armature in a Blender file. I want to export and import only the armature. If possible i'd like to render the armature in babylonjs for debuggin Then in my babylonJS app code I want to create and attach meshes to the bones. 

Are there any tutorials, docs, or examples showcasing this? Is this possible. Appreciate any help.

Link to comment
Share on other sites

@JCPalmer

Thanks looks like that correctly imports the skeleton only:

BABYLON.SceneLoader.Load("/assets/babylon/", "combined.babylon", engine, function (newScene) {...})
newScene.skeletons[0].bones.map((bone)=> {return bone.name})
["chest", "head", "shoulder.L", "bicep.L", "arm.L", "hand.L", "lever.L", "shoulder.R", "bicep.R", "arm.R", "hand.r", "leverl.R", "waist", "hip.L", "thigh.L", "knee.L", "foot.L", "hip.R", "thight.R", "knee.R", "foot.R"]

 

Now how can I get the skeleton to render? currently I have a black screen after the scene loads. I can publish and share the scene if that would be helpful.

Link to comment
Share on other sites

I don't think SkeletonViewer will work without instantiating it with a mesh.  You should be able to do this though:

var viewer = new BABYLON.Debug.SkeletonViewer(skeleton, new BABYLON.Mesh('', scene), scene); 

 

Link to comment
Share on other sites

@adam

how do I know the animation name there ( "name of your animation")

looks like my animations are children of the bones. and are named 'anim' when I try that I nothing happens

> skeleton.bones[0].animations[0]
< i {name: "anim", targetProperty: "_matrix", framePerSecond: 24, dataType: 3, loopMode: 1…}_blendingFactor: 0_events: Array[0]_highLimitsCache: Object_keys: Array[7]_offsetsCache: Object_ranges: Object_stopped: falseallowMatricesInterpolation: falseblendingSpeed: 0.01dataType: 3enableBlending: undefinedframePerSecond: 24loopMode: 1name: "anim"targetProperty: "_matrix"targetPropertyPath: Array[1]__proto__: Object
> skeleton.beginAnimation("anim", true, 1)
< null

 

Link to comment
Share on other sites

Quote

I have an animated armature in a Blender file.

Quote

how do I know the animation name there ( "name of your animation")

@kevzettler : Open a "Dopesheet" window in Blender (A in image below). Change the box B to "Action Editor" and you will see the name of an "Action" (an animation). If there maybe more than one "Action" click the little icon D for the names of other "Actions" (animations). These are the names you want.

cheers, gryff :)
 

dopesheet1.png

Link to comment
Share on other sites

For the record here both 

scene.beginAnimation(skeleton, 0, 25, true, 1.0);

and

skeleton.beginAnimation("ArmatureAction.001", true, 1);

 

worked. The missing piece for me was 

    var viewer = new BABYLON.Debug.SkeletonViewer(skeleton,  new BABYLON.Mesh('', blenderScene), blenderScene);
    viewer.isEnabled = true;

apparently viewer.isEnabled animates the skeleton viewer?

Link to comment
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...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...