是什么导致物理引擎的关节撕裂? [英] What causes the joints of a physics engine to tear?

查看:71
本文介绍了是什么导致物理引擎的关节撕裂?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将简短地介绍一下,知道我在说什么发生在2009年针对AS3的Box2d上,而今天也发生在JavaScript中完全独立的p2物理库中.

I will keep this brief, know that what I am talking about happened on Box2d for AS3 in 2009, and it also happens today with a totally separate library p2 physics in JavaScript.

请转到下面的2d布娃娃演示页面,并用力旋转布娃娃头部.

Please go to the following 2d ragdoll demo page and spin the ragdoll around by the head quite vigorously.

https://schteppe.github.io/p2.js/demos/ragdoll.html

您将看到关节分离并变成弹性的结果.

You will see the result that the joints separate and turn elastic.

这个问题使我无法通过物理使一切变得有趣.球和链,弹射器,叉车,布娃娃,蜘蛛侠射击网,2D车辆....

This problem prevents me making anything fun with physics. Ball and chains, catapults, forklifts, ragdolls, spiderman shooting webs, 2d vehicles.....

约束似乎是不稳定的,是多余的.我认为物理引擎适合说愤怒的小鸟或掉落的方块,但是一旦添加了约束,该项目就会变成适合破损的演示.

Contraints just seem unstable as to be superfluous. I am thinking that a physics engine is good for say angry birds, or falling blocks, but the moment you add Constraints, the project turns into Demo fit for breakage.

您能解释一下为什么会这样吗?我是天真吗?是否存在物理引擎来提供裸露的骨骼和约束?作为一名开发人员,我有责任运用数学方法使约束正常工作吗?

Can you explain why this happens? Am I being Naive? Does a physics engine exist to provide the bare bones bodies and constraints? It is upto me as a developer, to apply the math to make constraints work correctly?

推荐答案

物理引擎的关节(约束)可以看作是施加力的弹簧.弹簧不是坚如磐石-如果用力推,弹簧会弯曲.

Physics engine joints (constraints) can be thought of as springs that apply force. A spring is not rock solid - it will bend if you push it too hard.

关节的柔软度"通常与物理引擎的性能成正比.如果使用很小的时间步长和许多约束迭代,则可能会得到非常僵硬的关节,但性能却很差.如果强迫物理引擎使关节变硬,但使用较大的时间步长,则模拟将变得不稳定并可能爆炸.

The "softness" of the joints is often proportional to the performance of the physics engine. If you use tiny time steps and many constraint iterations, you can get very stiff joints, but poor performance. If you force the physics engine to make the joints stiff, but use a larger time step, the simulation will become unstable and probably explode.

关节将始终具有一定的柔韧性".您不能在任何时候,任何情况下都依靠节理看起来坚如磐石.作为基于物理学的游戏的开发者,您必须限制玩家不要破坏您的物理学.这可以通过多种方式来完成,例如,通过设置玩家施加的最大力量的限制或删除某些玩家互动来实现.

Joints will always have some "softness". You can not rely on joints to look rock solid at all times and under all circumstances. As a developer of a physics-based game, you must restrict the player to not break your physics. This can be done in many ways, for example by setting a limit on the maximum force applied by the player, or by removing some player interactions.

在游戏"坏小猪中,Rovio经常使用约束条件-但它们也限制了用户也可以进行交互的方式.

In the game "Bad Piggies", Rovio use constraints quite a lot - but they also put limits on the way the user can interact too.

物理引擎非常适合说愤怒的小鸟或掉落的方块,但是一旦添加了约束,项目就会变成适合破损的演示.

a physics engine is good for say angry birds, or falling blocks, but the moment you add Constraints, the project turns into Demo fit for breakage.

不太正确.碰撞的下降块"将创建接触-也是约束(在物理引擎内部).如果您用力推动触点,或通过施加太大的重力,触点也会显得有弹性.这就是为什么像《愤怒的小鸟》这样的游戏使用弱重力场的原因.

Not quite true. "Falling blocks" that collide will create contacts - which are constraints too (internally in the physics engine). If you push the contacts too hard, or by applying too much gravity, the contacts will look springy too. That's why games like Angry Birds use weak gravity fields.

制作基于物理的游戏让用户体验自由而不限制用户交互的方式是困难的,但并非不可能.

Making a physics based game where the user experiences freedom without limiting the way the user interacts is difficult - but not impossible.

这篇关于是什么导致物理引擎的关节撕裂?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆