开发者

how to remove box2d maxVelocity?

I don't know if there is such a parameter in box2D or not but when I duplicate all the numbers in my scene simulations produce different results, I was just simulating a pendulum (an static box joint to a dynamic box using revolute joint) and when I multiplied all the values in my scene by 32 (to have a same scale with my game), it fall slower than normal condition, (and i've increased gravity too). it seems like when pendulum is falling it reaches some max speed and doesn't go beyond that. so when it's comming back up it reaches half way to the height it started falling from. by the way I think it's not cause by frictio开发者_JS百科n because i've set all dumping and friction values to zero and beside this problem didn't apear before scaling my scene.


Change the value of b2_maxTranslation in b2Settings.h


Box2d is simulating using iterative solver and the result might be different for different size of objects - it's ok. In manual is written that the best size of simulated dynamic objects is 0.1 - 10 and up 50 for static bodies. Also increasing all sizes will not produce the same movement in a real world. For example imagine a 1 meter radius falling sphere from 100 meter height. Multiplying it's radius and height by 10 for example will obviously give different fall time, because it's only depend on height.

Also I've tried nvidia physx once. I've just created a very simple scene - a cube falling at the plane and bouncing. The cube was one meter at a side. First I was simulating with density of cube 10 and everything was perfect. Then i decided to simulate an iron cube and changed the density to 7200. As you understand the bounce was expected totally the same because the restitution parameter was not change. But the simulation was really ugly - the cube falling into the plane and bouncing ugly. So it's really important to keep the values in a recommended range.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜