XNA model with bones -
i created model in blender , used armature create pose. how can display pose in xna/monogame? can't find solution. use model exported fbx file. code here , draws model without armature effect:
protected override void draw(gametime gametime) { graphics.graphicsdevice.clear(color.cornflowerblue); // copy parent transforms. matrix[] transforms = new matrix[mymodel.bones.count]; mymodel.copyabsolutebonetransformsto(transforms); // draw model. model can have multiple meshes, loop. foreach (modelmesh mesh in mymodel.meshes) { // mesh orientation set, our camera , projection. foreach (basiceffect effect in mesh.effects) { effect.enabledefaultlighting(); effect.world = transforms[mesh.parentbone.index] * matrix.createrotationy(modelrotation) * matrix.createtranslation(modelposition); effect.view = matrix.createlookat(cameraposition, vector3.zero, vector3.up); effect.projection = matrix.createperspectivefieldofview(mathhelper.toradians(45.0f), aspectratio, 1.0f, 10000.0f); } // draw mesh, using effects set above. mesh.draw(); } base.draw(gametime); }
Comments
Post a Comment