2
\$\begingroup\$

I intended to use jbox2d for my project. But as I went deeper into it's manual I'd found out that it supports dynamic objects between 0.1 and 10 meters (if use scaling and assume that 0.1 is smallest unit we would have 100 units). I want to create pretty complex and big shapes about 1000 units width.

  • So will box2d will handle it?
  • Or I should simplify them more to achieve 100 units width max?
  • Or my calculations about 100 units width max are wrong? ( But if 0.1 meter is box2d minimum I don't think than I can get smaller unit as measure.)

I had also read about kollider2d, but can't find any info about stress testing it.

As in comment below:

I understand that it doesn't matter if 32 pixels of my system represents 0.1 meter of box2d system nor if it is 50 pixels. With good scale I can manage any value as minimum. I wan't to create objects 1000 times larger than smallest one. And I don't know if box2d will crash or try to handle it but will be very slow or inaccurate.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

The fact that Box2D can only handle objects between .1 and 10 meters only places the restriction on you that your largest object can only be 100 times larger than your smallest object. Box.2Ds coordinate system can be completely separate from your own, its will just take some multiplication to go back and forth between pixels and meters.

So if "I want to create pretty complex and big shapes about 1000 units width." means you want dynamic objects 1000 pixels wide that is fine with the caveat that your smallest body has to be at least 10 pixels wide.

For example in my game 32 pixels = 1 meter. So the smallest object I could have is 4 pixels across and the largest is 320 pixels. In your case a 100 pixels per meter might be better so that the min size of a body is 10 pixels and the max size is 1000 pixels.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ I understand that it doesn't matter if 32 pixels of my system represents 0.1 meter of box2d nor if it is 50 pixels. I wan't to create objects 1000 times larger than smallest ones. And I don't know if box2d will crash or try to handle it but will be very slow or inaccurate. \$\endgroup\$
    – 23k
    Commented Feb 3, 2012 at 18:37
  • 2
    \$\begingroup\$ As far as I know, box2D allows you to have objects as big as you want and still perform well in speed. I think the inacuracies of the simulation will increase as much as you distance from the "safe zone". \$\endgroup\$
    – Grimshaw
    Commented Feb 4, 2012 at 0:10
  • \$\begingroup\$ @DevilWithin that is correct \$\endgroup\$ Commented Feb 4, 2012 at 0:33
  • \$\begingroup\$ Do you know any alternative for jBox2D for case of big objects. I can use jbox2D for small objects and other library for big ones. \$\endgroup\$
    – 23k
    Commented Feb 8, 2012 at 14:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .