Shahar Nacht
Shahar Nacht

Reputation: 122

Can't play skeletal animation at all

im using three.js revision 71.
i exported a model from blender, that has 2 animations.

here is the code im using (apart from generic scene stuff):

//THE CYLINDER
loader.load("flipping cylinder.json",function(geometry,materials)
{
    var material=new THREE.MeshLambertMaterial();
    flipcyl=new THREE.SkinnedMesh(geometry,material);
    scene.add(flipcyl);

    anim=new THREE.Animation(flipcyl,flipcyl.geometry.animations[0]);
});

//UPDATE AND RENDER
function render()
{
    requestAnimationFrame(render);

    var delta=clock.getDelta();
    THREE.AnimationHandler.update(delta);

    renderer.render(scene,camera);
}
render();

i also have this in the HTML part:
<button onclick="anim.play();">play</button>

everything renders ok but nothing seems to change when clicking the button, or when i input anim.play() in the console.

(please forgive me for any english mistakes - im not a native english speaker...)

Upvotes: 0

Views: 74

Answers (1)

yombo
yombo

Reputation: 344

You just have to add this line while loading:

material.skinning = true;

And that's all! ;)

Upvotes: 1

Related Questions