モデル(車)に対する骨(ホイールなど)の位置行列または位置ベクトルのいずれかを取得する必要があります。
私が試したこと-
Vector3.Transform(mesh.BoundingSphere.Center , transforms[mesh.ParentBone.Index]*Matrix.CreateScale(o.Scaling )))
上記は正確な結果をもたらしません。
必要なのは、各ボーンの絶対変換を計算することです。CopyAbsoluteBoneTransformsToメソッドでそれを行うことができます。
これは、次のコードと同等です。
/// <summary>Calculates the absolute bone transformation matrices in model space</summary>
private void calculateAbsoluteBoneTransforms() {
// Obtain the local transform for the bind pose of all bones
this.model.CopyBoneTransformsTo(this.absoluteBoneTransforms);
// Convert the relative bone transforms into absolute transforms
ModelBoneCollection bones = this.model.Bones;
for (int index = 0; index < bones.Count; ++index) {
// Take over the bone transform and apply its user-specified transformation
this.absoluteBoneTransforms[index] =
this.boneTransforms[index] * bones[index].Transform;
// Calculate the absolute transform of the bone in model space.
// Content processors sort bones so that parent bones always appear
// before their children, thus this works like a matrix stack,
// resolving the full bone hierarchy in minimal steps.
ModelBone bone = bones[index];
if (bone.Parent != null) {
int parentIndex = bone.Parent.Index;
this.absoluteBoneTransforms[index] *= this.absoluteBoneTransforms[parentIndex];
}
}
}
ここから撮影。