○ドワーフのアニメータを作成した後、ファイルに保存されているアニメーションをロードします。ModelAnimator.Animations プロパティはコンテントパイプラインからロードされたアニメーションのコレクションを含みます。
○一つのアニメーションを再生させるために、新しい AnimationController クラスを作成します。ただ単にアニメーションを渡すだけです。
○アニメーションを再生するには dwarfAnimator.BonePoses に保存されている BonePose オブジェクトを列挙し、それらの CurrentController プロパティに適切な AnimationController を設定します。
○利便性を考慮し、全てのボーンのアニメーションを再生させるメソッドを作成して下さい。
// Add this as a new method
private void RunController(ModelAnimator animator, AnimationController controller)
{
foreach (BonePose p in animator.BonePoses)
{
p.CurrentController = controller;
p.CurrentBlendController = null;
}
}
○p.CurrentBlendController は、今は無視して下さい。
○LoadGraphicsContent メソッドで「立ち」状態のアニメーションを作成し、再生して下さい。
// Add this as a member variable
AnimationController idle;
// Add this in LoadGraphicsContent
idle = new AnimationController(this,
dwarfAnimator.Animations["idle0"]);
RunController(dwarfAnimator,idle);
○Great!ドワーフのアニメーション再生することができました。次に進む前にチュートリアルで使用する残りのコントローラを作成して下さい。
// Add these as member variables
AnimationController walk, run, nod, crouch, stayCrouched;
// Add this in LoadGraphicsContent
run = new AnimationController(this, dwarfAnimator.Animations["run"]);
walk = new AnimationController(this, dwarfAnimator.Animations["walk"]);
crouch = new AnimationController(this, dwarfAnimator.Animations["crouchDown"]);
stayCrouched = new AnimationController(this, dwarfAnimator.Animations["stayCrouched"]);
nod = new AnimationController(this, dwarfAnimator.Animations["nodHead"]);
最終更新:2009年06月21日 12:45