How to let 3d model move up, in fact is to give model bone set action, so the whole model will move up.
A Get Bones
You can see the names of all the bones in the fbx file so that you can get to bones by name.
turretBone = tankModel.Bones["turret_geo"];
cannonBone = tankModel.Bones["canon_geo"];
hatchBone = tankModel.Bones["hatch_geo"];
Two Save Bones Original Transform
turretTransform = turretBone.Transform;
cannonTransform = cannonBone.Transform;
hatchTransform = hatchBone.Transform;
Three Set actions for Bones
//设置动作的变化值
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);
//创建动作矩阵
turretRotation = Matrix.CreateRotationY(turretRotationValue);
cannonRotation = Matrix.CreateRotationX(cannonRotationValue);
hatchRotation = Matrix.CreateRotationX(hatchRotationValue);
Four Assigns the set action to the bones transform
turretBone.Transform = turretRotation * turretTransform;
cannonBone.Transform = cannonRotation * cannonTransform;
hatchBone.Transform = hatchRotation * hatchTransform;
From the above implementation code can be seen, if you want to let 3d model to move up, as long as the model contains the bones to give action, as well as the changes in the amount of movement, it can be.
Sample Download Address: http://www.52winphone.com/bbs/viewthread.php?tid=300&extra=page%3D1