Jump to content

Animation from Blender


Shivaan Keldon
 Share

Recommended Posts

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 ^^

Link to comment
Share on other sites

  • 1 month later...

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...