在 DirectX c++ 中更改锚点
我想建造一个可以在所有轴上旋转的炮塔。因此底座可以根据实际的 Y 值在 Y 轴上旋转,枪管在 X/Z 轴上旋转,就像普通炮塔一样,有半球底座和枪管是圆柱体。在简单的 DirectX 中执行此操作的最佳方法是什么? (我没有使用任何准备好的包,因为我想了解它而不仅仅是使用它)。
我认为最好的方法是将底座和枪管制作为单独的模型,然后旋转它们。
我认为有更好的解决方案,因为在大型游戏中,比如太空射击游戏,你可以在一场战斗中看到数百个炮塔,并且有相当大的效果等,所以我认为这可能会有点慢?
I would like to build turret, that can rotate in all axis. So the base could rotate in Y axis and the barrel in X/Z axis depending on actual Y value, just like normal turret, that have half ball base and the barrel is cylinder. What is best way to do this in simple DirectX? (I'm not using any prepared packs, because I want to elarn it not just use it).
I thought best way would be to make base and barrel as separate models, and then rotate them.
I think there is better solutionm because in big games, like space shooters, where you can see in one battle hundreads of turrets and there is quite big ammout of effects etc. so I think this could be little slow down?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不是模型构建者...请对我所说的持保留态度...
您仍然可以将整个炮台制作为一个模型,但枪管可以连接到模型内自己的骨骼上。这只是提供具有多次旋转的模型的简单方法(即围绕 Y 旋转整个物体,然后向上/向下旋转桶)。
就大型比赛而言,通常可以采取一些技巧来减少轮换次数。例如,任何近距离的涡轮机都可以渲染到完整的细节,而那些远处的涡轮机可以避免渲染全部涡轮机,因为它可能只渲染到屏幕上的单个像素。
I'm not a model builder.... take what I say with a grain of salt...
You can still make the whole turrent one model, but the barrel could be attached to its own bone inside the model. This is just a simple way of providing a model with multiple rotations (i.e. rotate the whole thing around Y and then rotate the barrel up/down).
As far as big games go, tricks can often be done to reduce the number of rotations. For example, any turrent up close could be rendered to full detail while those far away could avoid rendering the turrent all since it might only render to a single pixel on the screen.