How to make the 3d model work is actually to set the action for the bone of the model, so that the entire model will work.
1. Obtain Bones
You can view the names of all bones in the fbx file, so that you can obtain bones by name.
TurretBone = tankModel. Bones ["turret_geo"];
CannonBone = tankModel. Bones ["canon_geo"];
HatchBone = tankModel. Bones ["hatch_geo"];
2. Save bones Original Transform
TurretTransform = turretBone. Transform;
CannonTransform = cannonBone. Transform;
HatchTransform = hatchBone. Transform;
3. Set actions for Bones
// Set the change value of the action
TurretRotationValue = (float) Math. Sin (time * 0.333f) * 1.25f;
CannonRotationValue = (float) Math. Sin (time * 0.25f) * 0.333f-0.333f;
HatchRotationValue = MathHelper. Clamp (float) Math. Sin (time * 2) * 2,-1, 0 );
// Create an action matrix
Turrenttation = Matrix. CreateRotationY (turrenttationvalue );
CannonRotation = Matrix. CreateRotationX (cannonRotationValue );
HatchRotation = Matrix. CreateRotationX (hatchRotationValue );
4. Assign the set action to bones Transform
TurretBone. Transform = turretation * turretTransform;
CannonBone. Transform = cannonRotation * cannonTransform;
HatchBone. Transform = hatchRotation * hatchTransform;
From the above implementation code, we can see that if you want to make the 3d model move, you only need to assign the action and the amount of changes to the bones contained in the model.
Example: http://www.52winphone.com/bbs/viewthread.php? Tid = 300 & extra = page % 3D1