box2d icon indicating copy to clipboard operation
box2d copied to clipboard

v3.1 Tasks

Open erincatto opened this issue 1 year ago • 2 comments

  • [ ] sample character mover
  • [ ] smooth manifold merger
  • [ ] world serialization
  • [x] floating point determinism
  • [ ] rolling resistance
  • [ ] infinite planes
  • [x] 64 bit category and mask bits
  • [ ] clang-cl support in VS

erincatto avatar Aug 31 '24 22:08 erincatto

https://box2d.org/posts/2024/08/determinism/

erincatto avatar Sep 08 '24 16:09 erincatto

I investigated using realloc, but alignment is not well supported.

erincatto avatar Sep 12 '24 18:09 erincatto

Character movement reference: https://x.com/MaddyThorson/status/1238338574220546049

erincatto avatar Dec 27 '24 05:12 erincatto

world serialization in 3.2

erincatto avatar Jan 22 '25 21:01 erincatto

Removed infinite planes. Only one user asked for it so it is not widely useful or worth the effort.

erincatto avatar Apr 05 '25 23:04 erincatto

Removed smooth manifold merger because I took a different approach with the character mover

erincatto avatar Apr 05 '25 23:04 erincatto

Here are some of the technical problems with infinite planes:

  • it is a new shape type
  • it cannot be added to the broad-phase because it is too big, this means it needs special logic in many places
  • contact points can be very far from the plane body's origin, leading to precision problems

I already recommend people don't create bodies bigger than ~20meters for precision reasons.

If someone makes a fork and shows how all these problems can be addressed without much complexity then I will reconsider.

erincatto avatar Apr 14 '25 06:04 erincatto

if most worlds only need one plane (the ground), wouldn't the performance hit of special-casing collision checks for a single, unique shape type be an acceptable trade-off?

even with precision limitations far from the origin, it might still be a good enough and super convenient solution for ground and other boundaries instead of needing huge finite boxes

amytimed avatar Apr 14 '25 20:04 amytimed

It would be an interesting to test a huge box and see how the stability looks far from the origin compared to a smaller ground box with an origin closer to the active bodies.

This would be somewhat similar to an infinite plane for stability.

A single infinite plane per world would be easier. It would be in the b2WorldDef.

erincatto avatar Apr 15 '25 01:04 erincatto

I tested the card house with sleeping disabled. It is a bit less stable with a huge ground box offset from the origin by 20km.

#if 1
		{
			b2BodyDef bodyDef = b2DefaultBodyDef();
			bodyDef.position = { 20000.0f, -5000.0f };
			b2BodyId groundId = b2CreateBody( m_worldId, &bodyDef );

			b2ShapeDef shapeDef = b2DefaultShapeDef();
			shapeDef.material.friction = 0.7f;

			b2Polygon groundBox = b2MakeBox( 30000.0f, 5000.0f );
			b2CreatePolygonShape( groundId, &shapeDef, &groundBox );
		}
#else
		{
			b2BodyDef bodyDef = b2DefaultBodyDef();
			bodyDef.position = { 0.0f, -2.0f };
			b2BodyId groundId = b2CreateBody( m_worldId, &bodyDef );

			b2ShapeDef shapeDef = b2DefaultShapeDef();
			shapeDef.material.friction = 0.7f;

			b2Polygon groundBox = b2MakeBox( 40.0f, 2.0f );
			b2CreatePolygonShape( groundId, &shapeDef, &groundBox );
		}
#endif

erincatto avatar Apr 15 '25 06:04 erincatto