我如何轮流使用一个kin光模型,而不是模型的起源?
在<条码>Skinning Sample中,当我轮流耳朵时,它围绕模式的起源轮流。 如果有可能,我就希望把骨头放在自己的来源上。
<>GetSkin Transforms()的描述如下:
"Gets the current bone transform matrices, relative to the skinning bind pose."
因此,我怀疑可能是问题。 是否有任何人知道如何将这些转变转化为他们需要做什么?
页: 1
float rotation = 0;
protected override void Update(GameTime gameTime)
{
HandleInput();
UpdateCamera(gameTime);
animationPlayer.UpdateWorldTransforms(Matrix.Identity);
animationPlayer.UpdateSkinTransforms();
Matrix RotationTransform = Matrix.CreateFromYawPitchRoll(rotation, 0, 0) ;
animationPlayer.GetSkinTransforms().SetValue(RotationTransform, 34);
rotation = rotation + .1f;
base.Update(gameTime);
}
/// <summary>
/// This is called when the game should draw itself.
/// </summary>
protected override void Draw(GameTime gameTime)
{
GraphicsDevice device = graphics.GraphicsDevice;
device.Clear(Color.CornflowerBlue);
Matrix[] bones = animationPlayer.GetSkinTransforms();
// Compute camera matrices.
Matrix view = Matrix.CreateTranslation(0, -40, 0) *
Matrix.CreateRotationY(MathHelper.ToRadians(cameraRotation)) *
Matrix.CreateRotationX(MathHelper.ToRadians(cameraArc)) *
Matrix.CreateLookAt(new Vector3(0, 0, -cameraDistance),
new Vector3(0, 0, 0), Vector3.Up);
Matrix projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4,
device.Viewport.AspectRatio,
1,
10000);
// Render the skinned mesh.
foreach (ModelMesh mesh in currentModel.Meshes)
{
foreach (SkinnedEffect effect in mesh.Effects)
{
effect.SetBoneTransforms(bones);
effect.View = view;
effect.Projection = projection;
effect.EnableDefaultLighting();
effect.SpecularColor = new Vector3(0.25f);
effect.SpecularPower = 16;
}
mesh.Draw();
}
base.Draw(gameTime);
}