Box2d: Maximum possible linear velocity?

后端 未结 2 1364
暗喜
暗喜 2020-12-18 00:14

I think I\'ve configured Box2d to have some sort of maximum velocity for any body, but I\'m not sure. I apply an impulse like (100000000, 100000000), and the bo

相关标签:
2条回答
  • 2020-12-18 00:36

    That's not the way to fix that problem. You are supposed to scale down your objects when creating them in the box2D world. Then you can just scale the information that box2D gives you back to the size of your world.

    Let's say for example that a box in my world is 120 pixels long. If I scaled the object down by 30 times so that it can be simulated by box2d properly then the length of my box in the box2D world would be 4 "pixels" long (120 / 30 or size of your object / scale). Now, let's say that box2D calculates that my box moved 3 "pixels" in the box2d world. I could then grab that information and scale it back up to my world's size which would mean that the box just moved 90 pixels (3 * 30). I hope that didn't sound too confusing. I usually find it hard to explain myself.

    0 讨论(0)
  • 2020-12-18 00:39

    I have the same problem with version 2.1a i found out that changing line 128 in b2Settings.as can help. Change static public const b2_maxTranslation:Number = 2.0 to a higher number. sure that this isn't the right way, but right now dont really know how to do it correctly.

    0 讨论(0)
提交回复
热议问题