Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I might be able to give you some beginner-to-beginner advice.</p> <p>I just learned how to make a model from <a href="http://xbox.create.msdn.com/en-US/education/catalog/sample/simple_animation" rel="nofollow">this example</a> and based on your quesiton I applied an additional scale transform to one of the bones to see if I could manipulate its size the same way I can its position, and it did work.</p> <p>So I'm implying the answer to your question may be that while a model's vertex data remains constant you can make it change shape using Scale transforms.</p> <p>Here's my model:</p> <pre><code>using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; namespace SimpleAnimation { public class Body { Model bodyModel; ModelBone headBone; ModelBone bodyBone; Matrix headTransform; Matrix bodyTransform; Matrix[] boneTransforms; public Body() { HeadScale = 1; } public void Load(ContentManager content) { // Load the tank model from the ContentManager. bodyModel = content.Load&lt;Model&gt;("body"); // Look up shortcut references to the bones we are going to animate. headBone = bodyModel.Bones["head"]; bodyBone = bodyModel.Bones["body"]; // Store the original transform matrix for each animating bone. headTransform = headBone.Transform; bodyTransform = bodyBone.Transform; // Allocate the transform matrix array. boneTransforms = new Matrix[bodyModel.Bones.Count]; } public void Draw(Matrix world, Matrix view, Matrix projection) { // Set the world matrix as the root transform of the model. bodyModel.Root.Transform = world; // Calculate matrices based on the current animation position. Matrix headRotation = Matrix.CreateRotationX(HeadRotation); Matrix headScale = Matrix.CreateScale(HeadScale); Matrix bodyRotation = Matrix.CreateRotationX(BodyRotation); // Apply matrices to the relevant bones. headBone.Transform = headScale * headRotation * headTransform; bodyBone.Transform = bodyRotation * bodyTransform; // Look up combined bone matrices for the entire model. bodyModel.CopyAbsoluteBoneTransformsTo(boneTransforms); // Draw the model. foreach (ModelMesh mesh in bodyModel.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.World = boneTransforms[mesh.ParentBone.Index]; effect.View = view; effect.Projection = projection; effect.EnableDefaultLighting(); } mesh.Draw(); } } public float HeadRotation { get; set; } public float HeadScale { get; set; } public float BodyRotation { get; set; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload