1

我想做一个fps游戏。我需要武器模型与相机相距例如 15Z个单位,并与相机指向的方向相同。我几乎什么都试过了,但我没能做到。我尝试将相同的旋转矩阵与相机和模型矩阵相乘,并且还尝试了这个:

Matrix view = Matrix.CreateLookAt(new Vector3(0, 0, 0), new Vector3(0, 0, 200), Vector3.Up);
Gun = Matrix.CreateWorld(gunPos, Vector3.Forward, Vector3.Up);'
gunPos = cameraPos + view.Forward * 15;

我怎样才能使它正常工作?

4

1 回答 1

0
Gun = Matrix.Invert(view);
Gun.Translation += (Gun.Forward * 15); // + (Gun.Down * 4) + (gun.Right * 2);
于 2012-12-31T17:59:24.863 回答