Shivaan Keldon Posted December 9, 2013 Share Posted December 9, 2013 Hi, I try, since yesterday, to start an animation loaded from Blender, but nothing appens. All my scene is loaded from blender. There's camera, lights, walls, a character with its rig, and an animation set for "walk".After reading this tutorial (https://github.com/BabylonJS/Babylon.js/wiki/How-to-use-bones-and-skeletons), I decided to loop manually into scene.meshes to retreive the character, and attach the scene.skeleton[0] to it. I've checked that all vertex groups are ok in Blender, and that each vertex has maximum 4 bones influence (not so easy). The mesh _vertexBuffer has only color, normal and position, but doesn't have matrices weight or matrice indices. Is it the problem ?How can I generate this values ? Is there something to do in Blender to import them automatically ? Here's the light version of my code :<script>var canvas, engine, scene, player;function render(){ scene.render();}window.onload = function(){ canvas = document.getElementById("renderCanvas"); engine = new BABYLON.Engine(canvas, true); BABYLON.SceneLoader.Load("", "testroom.babylon", engine, function (nscene) { scene = nscene; scene.executeWhenReady(function () { for(var i=0,n=scene.meshes.length; i<n; i++) { if(scene.meshes[i].name=="player"){ player = scene.meshes[i]; player.skeleton = scene.skeletons[0]; } } scene.beginAnimation(player.skeleton,0,60,true,1.0); engine.runRenderLoop(render); }); });};</script>Thanks PS: Babylon is really great and has a good render engine. But it could be great to have an API and more examples when building a game from Blender. But well, it's still young and I think it will come after ^^ Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 9, 2013 Share Posted December 9, 2013 Yes this is the problem Do you have an armature linked to your mesh ? this is how we detect bones and add weights into the .babylon file Quote Link to comment Share on other sites More sharing options...
Shivaan Keldon Posted December 9, 2013 Author Share Posted December 9, 2013 Yes, there's a human skeleton in blender, and a modifier to apply it on the character Here's a screenshot of Blender : Do I have to apply the armature ? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 9, 2013 Share Posted December 9, 2013 Yes you have to But my knowledge of Blender is really limited alas Quote Link to comment Share on other sites More sharing options...
Shivaan Keldon Posted December 9, 2013 Author Share Posted December 9, 2013 Applying changes nothing in babylon but the animation doesn't work in Blender anymore :-/ Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 9, 2013 Share Posted December 9, 2013 It should at least work in Blender:) Quote Link to comment Share on other sites More sharing options...
Shivaan Keldon Posted December 9, 2013 Author Share Posted December 9, 2013 The armature moves but not the mesh... I'm quite new in Blender and maybe I do something wrong :-/ Quote Link to comment Share on other sites More sharing options...
ProfessorF Posted December 13, 2013 Share Posted December 13, 2013 In Autodesk Maya, you have to attach the skeleton to the model. I'm sure in Blender it's the same way--you need to attach the skin to the model. Quote Link to comment Share on other sites More sharing options...
Red Ruler Posted January 27, 2014 Share Posted January 27, 2014 HiRemove armature modifier. Then select the model, and then the Armature. Control+P -> Armature Deform -> With Automatic Weights. It'll work. JackFalcon 1 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.