Hello,
I use the newest FBX-Loader and the model is showing up fine and is textured as it should.
But now, how can I connect the morph targets and the bones in my FBX-file to the dat.gui sliders so the sliders appear and I can move them?
Is this done the same way as JSON, with the “morphTargetInfluences” like the line below?
… folder.add( params, ‘influence1’, 0, 1 ).step( 0.01 ).name(‘Mouth_Open’).listen().onChange( function( value ) { mesh.morphTargetInfluences[ 6 ] = value;});…
I could not figure out how to do that in a different way.
Thanks for the help.
JSONLoader creates Geometry
while newer loaders create BufferGeometry
, so there are slight differences but I think this should work for both:
folder.add( mesh.morphTargetInfluences, '0', 0, 1 ).step( 0.01 ).name('A').listen();
folder.add( mesh.morphTargetInfluences, '1', 0, 1 ).step( 0.01 ).name('B').listen();
folder.add( mesh.morphTargetInfluences, '2', 0, 1 ).step( 0.01 ).name('C').listen();
folder.add( mesh.morphTargetInfluences, '3', 0, 1 ).step( 0.01 ).name('D').listen();
Using a GUI to control bones will get messy with many bones but the basics are simple enough:
folder.add( bone.rotation, 'y', 0, 360 ).name( 'Arm' );
Thanks for your answer. Unfortunately, it did not work out with that code.
Here is the FBX-model, the texture and the dat.gui code so far. Maybe you can give me the code to make this work, sadly, I could not figure it out and I am somehow stock here…
Thanks for your answer.
PapageiFBXBinary.fbx (1.5 MB)
var params = {
BlendShape_1: 0.0,
};
var gui = new dat.GUI({
autoplace: false,
width: 250,
height: 9 * 32 - 1
});
var folder = gui.addFolder( 'BlendShape' );
folder.add( params, 'BlendShape_1l', 0, 1 ).step( 0.01 ).name('Mouth_open').listen().onChange( function( value ) { Geometry.BlendShapeChannel[ 92890752 ] = value;});
folder.open();
var update = function() {
};
render()
That code is not what I’d suggested, can you share your more complete code (or a demo) including the part where you load the model?