Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

So I currently have an object made up of only one mesh. And this object contains three bones. One for strecthing the mesh left, one for streching the mesh up, and a center bone, which moves the object around. This is how my model and the bones/mesh hierarchy looks like:

Now, the problem is I dont know how to draw this mesh in XNA, I mean I dont know which transform to use.

I am using this code to draw:

Matrix[] transforms = new Matrix[model.Model.Bones.Count];
model.Model.CopyAbsoluteBoneTransformsTo(transforms);

foreach (ModelMesh mesh in model.Model.Meshes)
{
    foreach (BasicEffect effect in mm.Effects)
    {
        effect.View = camera.view;
        effect.Projection = camera.projection;
        effect.World =; //I dont know which to use
        effect.EnableDefaultLighting();
    }
    mesh.Draw();
}

If I debug it, and then look at the code, it comes up with 7 bones in this orde(as seen in the picture):

-Obj,

-CenterArmature,

-Center(CenterArmatures bone),

-GorArmature,

-Zgoraj(GorArmatures bone),

-LevoArmature,

-Levo(LevoArmatures bone).

Thanks in advance!

share|improve this question
    
Why do you have three armatures? You should put all three bones into one armature instead. Then you can use the vertex group weights named the same as the bone to know how much each bone influences a vertex. –  ccxvii Feb 3 '13 at 11:46
    
How can add all bones under one armature? Under add I only have Armature->SingleBone, which creates a completely new armatue. –  user1806687 Feb 3 '13 at 12:03
    
So I have manged to add bones to armature by extruding from one bone and then disconnecting(removing the parent) of the new bone. But now if I am in POSE mode and move the new bone, the mesh deformation is delayed, its not synced with the movement of the bone and it rotates the mesh insted of just moving it. –  user1806687 Feb 3 '13 at 13:01
    
Have you done any weight painting to assign vertices to bones? Maybe you should watch some tutorials on rigging and animating in blender. cgcookie.com/blender/2011/12/12/… –  ccxvii Feb 3 '13 at 15:18
    
Weight painting is done correctly, so are vertex groups and their names. –  user1806687 Feb 3 '13 at 15:27
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.