开发者

Farseer span between objects

开发者 https://www.devze.com 2023-03-18 06:17 出处:网络
There is situation: object \"A\" falls down on static object \"B\", but when \"A\" lands on \"B\" there is spa开发者_Python百科n between \"A\" and \"B\". How to solve the issues?Box2d is using iterati

There is situation: object "A" falls down on static object "B", but when "A" lands on "B" there is spa开发者_Python百科n between "A" and "B". How to solve the issues?


Box2d is using iterative solver and the quality of simulation depends on numerical values you use in simulation. In box2d manual is recommended to keep dynamic body's dimensions in range [0.1, 10] for example. The accuracy 0.002 (from your comment) is a very good one.

So there are two ways to solve your problem. Change the measuring system you use or increase position and/or velocity iterations. First way is much better because it will not increase the calculation time.


Box2d has b2_linearSlop parameter (AKA 'Skin' in PhysX)

It's a little addition to the size of geometry to improve stability of physics simulations. Maybe it causes the artefacts described by you.

Try to look for the following strings in the source code of box2d (I've taken it from flash port of the original box2d, nonetheless it should be the same for other platforms):

/**
* A small length used as a collision and constraint tolerance. Usually it is
* chosen to be numerically significant, but visually insignificant.
*/
static public const b2_linearSlop:Number = 0.005;   // 0.5 cm
0

精彩评论

暂无评论...
验证码 换一张
取 消