XNA 4.0 - 围绕自己的轴和世界中心旋转

时间:2013-04-24 19:02:47

标签: xna rotation xna-4.0

我有绕太阳旋转的行星。太阳在中间。

我想让行星围绕太阳和它们自己的轴旋转。

我的轮换代码是:

 world_.SetValue(Matrix.CreateRotationZ(-(float)
                  ((gameTime.TotalGameTime.TotalSeconds % 100) * 2 * Math.PI / 100)));

在我看来,它很容易实现(因为我可以在OpenGL,Android等中实现),但由于某些原因,我卡住了......

1 个答案:

答案 0 :(得分:0)

你希望transalate围绕行星运行,rotate围绕自己的轴运行。

worldMatrix=scaleMatrix * rotateMatrix(around own axis) * translateMatrix(around the sun)
相关问题