kevzettler Posted June 4, 2016 Share Posted June 4, 2016 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. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 4, 2016 Share Posted June 4, 2016 try moving meshes to another layer, then on scene tab there is a checkbox 'selected layers only' in the exporter section. Quote Link to comment Share on other sites More sharing options...
kevzettler Posted June 4, 2016 Author Share Posted June 4, 2016 @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. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 5, 2016 Share Posted June 5, 2016 var viewer = new BABYLON.Debug.SkeletonViewer(skeleton, null, scene); // mesh can be null since coming from blender exporter version >= 4.0, I think engine.runRenderLoop(function () { scene.render(); viewer.update(); }); Quote Link to comment Share on other sites More sharing options...
kevzettler Posted June 5, 2016 Author Share Posted June 5, 2016 @JCPalmer So what version is BABYLON.Debug in ? I'm using the one off npm https://www.npmjs.com/package/babylonjs Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 5, 2016 Share Posted June 5, 2016 2.4.beta Quote Link to comment Share on other sites More sharing options...
adam Posted June 5, 2016 Share Posted June 5, 2016 @kevzettler you spelled skeleton wrong Quote Link to comment Share on other sites More sharing options...
adam Posted June 5, 2016 Share Posted June 5, 2016 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); Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 5, 2016 Share Posted June 5, 2016 your right. Too bad skeleton does not have its own world matrix. Why not set the mesh material to something invisible? Quote Link to comment Share on other sites More sharing options...
kevzettler Posted June 5, 2016 Author Share Posted June 5, 2016 Thank's guys look's like that works! Quote Link to comment Share on other sites More sharing options...
kevzettler Posted June 5, 2016 Author Share Posted June 5, 2016 @adam @JCPalmer How can I then run the skeleton's animations I was hoping scene.beginAnimation(scene.skeletons[0], 0, 100, true); would work. but dosen't seem to. Do I have to call `beginAnimation` on the bones individually? Quote Link to comment Share on other sites More sharing options...
adam Posted June 6, 2016 Share Posted June 6, 2016 try skeleton.beginAnimation("name of your animation", true, 1); Quote Link to comment Share on other sites More sharing options...
kevzettler Posted June 7, 2016 Author Share Posted June 7, 2016 @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 Quote Link to comment Share on other sites More sharing options...
gryff Posted June 7, 2016 Share Posted June 7, 2016 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 Quote Link to comment Share on other sites More sharing options...
kevzettler Posted June 7, 2016 Author Share Posted June 7, 2016 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? 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.