4
A
回答
7
您可以使用微軟的SkinnedModelSample。請確保您設置的FBX文件SkinnedModelProcessor在屬性框的ContentProcessor屬性,然後你就可以做(需要優化):
主要遊戲類:
AnimationPlayer player;// This calculates the Matrices of the animation
AnimationClip clip;// This contains the keyframes of the animation
SkinningData skin;// This contains all the skinning data
Model model;// The actual model
LoadContent方法:
model = Content.Load<Model>("path_to_model");
skin = model.Tag as SkinningData;// The SkinnedModelProcessor puts skinning data in the Tag property
player = new AnimationPlayer(skin);
clip = skin.AnimationClips["run"];// The name of the animation
player.StartClip(clip);
繪製方法:
Matrix[] bones = player.GetSkinTransforms();
// Compute camera matrices.
Matrix view = Matrix.CreateLookAt(new Vector3(0, 0, -30), // Change the last number according to the size of your model
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 model.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();
}
相關問題
- 1. 攪拌機:多個動畫
- 2. XML3D:從攪拌機導出動畫
- 3. 在攪拌機
- 4. 從cinema4d到攪拌機的3d動畫
- 5. 加載攪拌機動畫到libGDX
- 6. 如何在攪拌機
- 7. 攪拌機
- 8. 攪拌機和itunes
- 9. 原始攪拌機出口商攪拌機python腳本
- 10. 攪拌機到統一5:與許多鑽機動畫
- 11. 如何在攪拌機中使用opencv(C++)代碼?
- 12. 如何將運動應用於攪拌機中的模型
- 13. 攪拌機出口到Three.js
- 14. three.js所從攪拌機
- 15. 紋理攪拌機2.57
- 16. 我要導入攪拌機
- 17. 訪問攪拌機對象
- 18. 攪拌機的頂點動畫出口商?
- 19. 攪拌機出口THREE.js
- 20. 如何開始攪拌機編碼?
- 21. THREE.js上傳細胞骨折攪拌機動畫
- 22. THREE.ShaderMaterial的JSON從攪拌機
- 23. 在攪拌機中運行python腳本
- 24. PyQt在場景3D中的攪拌機
- 25. 在攪拌機中創建場景
- 26. 攪拌機導入three.js庫
- 27. 使用python旋轉相機在攪拌機中
- 28. 在攪拌機中使用我的世界鑽機
- 29. 重置動畫的時間軸 - 攪拌機2.6
- 30. 攪拌機:如何從python腳本移動攝像機
見http://create.msdn.com/en-US/education/catalo g/sample/custom_model_rigid_and_skinned和http://blog.diabolicalgame.co.uk/2011/07/exporting-animated-models-from-blender.html –