Pygame中的度量坐标系
我是Pygame的新手,我正在努力模拟行人和车辆的运动,但是,我想拥有对象的位置和速度的值。那么,是否可以使用Pygame拥有度量坐标系?以及如何?如果没有,您知道类似的Python仿真工具可以满足此要求吗?
I am new in PyGame and I am working on simulating pedestrians and vehicles movements, However, I would like to have the values of objects' position and velocities in meters. So, is it possible to have a metric coordinate system with PyGame? and how? and if not, do you know a similar python simulation tool can meet this requirement?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
考虑一下Minecraft这样的游戏。大多数人都知道这些块是“一个立方米”,但这仅仅是因为游戏开发人员已经这样说了,并且一切都出现了。制定开发的测量单位在很大程度上是任意的(就像现实世界一样)。您可以使自己在游戏空间中看起来像是1米的单元正方形,并相应地扩展所有内容。
创建常数变量可能是一个好主意,太
终有int meter_in_pixels = 20;
这样,您需要做的任何数学都可以用作单元仪表
路线长= 130 *米_in_pixels; //长130米
Think about a game like Minecraft. Most people know the blocks are "one cubic meter" but only because the game devs have said so and everything appears that way. Units of measurement in gave development are largely arbitrary (just like the real world). You can make yourself what appears to be a 1-meter unit square in your game space and scale everything accordingly.
Creating a constant variable would probably be a good idea too
final int METER_IN_PIXELS = 20;
this way in any math you need to do it can be used as your unit meter
roadLength = 130 * METER_IN_PIXELS; //130 meters long