XNA(MonoGame)世界空间和物体运动
我刚刚开始在 XNA 中进行 3D 编码,并试图了解一些事情。
我使用 XNA 的目标是制作一款太空模拟游戏(我知道是原创的)我能够绘制模型并且我的相机可以按我希望的方式工作,我遇到的麻烦是理解如何移动我的敌人船舶。我在 2d 中的转向行为方面做了一些有价值的工作,但在 3d 中却没有。
我的问题是:
如果我尝试移动船只来“寻找”某个位置,这种移动如何影响船只的世界矩阵(如果有的话)?我正在使用 Vector3s,并将加速度添加到速度,然后将速度添加到位置。这是正确的方法吗?
我不必现在就发帖,或者我会的,我只是想了解应该采取什么方法。
谢谢
I just started with 3D coding in XNA and am trying to get my head around a few things.
My goal with XNA is to make a space sim game (original, I know) I am able to draw models and my camera is working as I'd like it to, where I am running into trouble is in understanding how to move my enemy ships. I have done some worth with steering behaviors in 2d, but not 3d.
My question is:
If I am trying to move ships to 'seek' a location, how does this movement effect the ship's world matrix (if at all)? I am using vector3s, and adding the acceleration to the velocity, and then the velocity to the position. Is this the right approach?
I do not have to post right now or I would, I am merely trying to understand what approach to take.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为您的对象/实体/船舶提供位置(Vector3)和旋转(矩阵),然后您可以使用以下代码(以及本答案底部的示例)来移动船舶。
例如将船向前移动 5 个单位:
让你的船桶滚动 90 度
这是示例代码
Give your object/entity/ship a position (Vector3) and rotation (Matrix), and then you can use the following code (and the sample at the bottom of this answer) to move the ship around.
For example to move the ship forward 5 units:
To make your ship barrel roll 90 degrees
And here's the sample code