我正在制作3D汽车游戏,我有旋转问题.我想围绕自己旋转模型,但是当我移动时,它开始在世界各地移动!
问题是:如何让模型的中心移动?
我试图改变这样的代码:
effect.World = Matrix.CreateRotationZ(modelRotation) * effect.World = Matrix.CreateTranslation(position);
Run Code Online (Sandbox Code Playgroud)
现在不是相对于模型向前移动,而是朝着设定的方向移动!这是我的代码:
effect.World = Matrix.CreateTranslation(position) * Matrix.CreateRotationZ(modelRotation);
effect.View = camera.View;
effect.Projection = camera.Projection;
Run Code Online (Sandbox Code Playgroud)