限制统一刚性车身动态更换平面
我正在制作基于物理的油箱游戏,我需要将轨道保留(由许多单独的链接组成,每个链接都带有intim
和strig> arigidbody
),我真的不知道这样做的最佳方法,我希望游戏尽可能地基于物理,但我不想模拟毫无意义的高度细节(希望尽可能避免网格山脉)。将链接限制为导向轮定义的平面的链接应该很好,但是我看不到这样做的好方法。关于如何实现所需的影响,任何建议都挂了,请记住,链接使用框墙面。
I am making a physics based tank game, I need to keep the tracks (made up of many individual links, each with a Joint
and a Rigidbody
) on the guide wheels, I don't really know the best way of doing this, I want the game to be as physics based as possible but I don't want to simulate a pointlessly high level of detail (want to avoid mesh colliders as much as possible). It should be fine to constrain the links to a plane defined by the guide wheels, but I can't see a good way to do this. Any suggestions are apricated as to how I could achieve the desired affect, please keep in mind that the links use box colliders.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为了获得最高的性能,我建议实现自己的迭代求解器。几年前,我这样做是为了在其轨道上保留(相当不重要的细节)玩具火车。我会假冒重力和紧张等效果。这样,您就可以保持控制权,并且可以设计游戏中最关键的部分,以表现出自己的意愿。可以通过许多无形的车轮墙面或直接在环境上施加力来模拟物理相互作用。
迭代求解器算法具有领先的链接,该链接在分段线性路径上移动给定的距离。然后,迭代地求解第二个链接的位置,在该位置,您希望其连接点的距离尽可能接近零,同时在路径上找到正确的位置。只是找到便宜的黑框功能的零问题。冲洗并重复,直到您具有最后一个链接的位置(需要解决两个连接器点)。您可以通过估计初始猜测等等(如果需要)来真正快速(如果需要)。通过引入或放松约束可以实现重力等效果。
For maximum performance, I suggest implementing your own iterative solver. I did so a few years ago for keeping a (rather unimportant detail) toy train on its tracks. I would fake effects like gravity and tension. This way, you stay in control and you can design the most crucial part of your game to behave like you want it to. Physical interaction can be simulated by many small invisible wheel colliders or by directly exerting forces on the environment.
The iterative solver algorithm has a leading link, which moves a given distance on a piecewise-linear path. Then iteratively solve for the position of the second link, where you want the distance of their connection point to be as close to zero as possible while finding the correct position on the path. Just a matter of finding the zero of a cheap-to-evaluate black box function. Rinse and repeat until you have the position of the last link (which needs to solve for two connector points). You can make this really fast (if needed) by estimating initial guesses and so on. Effects like gravity can be achieved by introducing or relaxing constraints.
我已经意识到,可配置的接头是可能的。由于在本地空间中定义了空间对比,因此应该可以在没有太多困难的情况下获得所需的效果。
I have realised this is possible with configurable joints. Since spacial contraints are defined in local space, it should be possible to get the desired effect without too much difficulty.