pygame 与 VPython 可视化 PyODE
我制作了一个类似于第二个 PyODE 教程的程序,但使用 VPython 而不是 pygame,并且删除了用于更改坐标的 coord 函数。它可以工作,但球体和关节的定位不正确。我猜测这是因为我在 VPython 中使用 PyODE 世界坐标。在我描述的情况下,这会导致任何问题吗?
I made a program similar to the second PyODE tutorial but using VPython instead of pygame and I removed the coord function for changing coordinates. It works but the locating of the spheres and joints isn't correct. I am guessing that it is because I am using the PyODE world coordinates within VPython. Would this in the circumstance I described cause any kind of problems?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有一个 pyode 教程 #2 的重新实现,它将 pyode 与 VPython 结合在一起,包含在 Visualpyode 库中,可在 mission cognition。该库使用的解决方案是使用 ode 坐标系和方向,并将它们复制到每次迭代的视觉对象/框架(pos、axis、up),使用 pyode 四元数旋转局部轴 (1,0,0)和向上 (0,1,0) 向量到世界坐标。还有一些更微妙的地方,所以最好的办法是获取源代码并浏览它。或者,您可以使用 Visualpyode 提供的合并 API 来构建您的 sim,并跳过所有细节。
There is a reimplementation of pyode tutorial #2 which marries pyode with VPython included in the visualpyode library available at mission cognition. The solution used by that library is to use the ode coordinate system and orientations and copy them to the visual objects/frames (pos, axis, up) for each iteration, using the pyode quaternion to rotate local axis (1,0,0) and up (0,1,0) vectors into world coordinates. There are a few more subtleties involved so the best thing to do is grab the source code and walk through it. Alternatively you could just build your sim using the merged API that visualpyode provides and skip all the details.