Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix aligned box collision #868

Open
erincatto opened this issue Jan 20, 2025 · 1 comment
Open

Fix aligned box collision #868

erincatto opened this issue Jan 20, 2025 · 1 comment
Assignees
Labels

Comments

@erincatto
Copy link
Owner

The boxes are slightly separated and clipping is just giving one contact point.

https://discord.com/channels/460295137705197568/1064661081903075429/1330362522888437814

	explicit SingleBox( Settings& settings )
		: Sample( settings )
	{
		if ( settings.restart == false )
		{
			g_camera.m_center = { 0.0f, 2.5f };
			g_camera.m_zoom = 3.5f;
		}

		float extent = 0.5f;

		{
			b2BodyDef bodyDef = b2DefaultBodyDef();
			b2Polygon box = b2MakeBox( extent, extent );
			bodyDef.position = { 0.0f, 20.0f };
			;
			bodyDef.type = b2_dynamicBody;
			b2BodyId bodyId = b2CreateBody( m_worldId, &bodyDef );
			b2ShapeDef shapeDef = b2DefaultShapeDef();
			b2CreatePolygonShape( bodyId, &shapeDef, &box );
		}
		{
			b2BodyDef bodyDef = b2DefaultBodyDef();
			//b2Polygon box = b2MakeSquare( 0.9f * extent );
			b2Polygon box = b2MakeSquare( extent );
			bodyDef.position = { 0.0f, 0.0f };
			bodyDef.type = b2_staticBody;
			b2BodyId bodyId = b2CreateBody( m_worldId, &bodyDef );
			b2ShapeDef shapeDef = b2DefaultShapeDef();
			b2CreatePolygonShape( bodyId, &shapeDef, &box );
		}
	}
@erincatto erincatto added the bug label Jan 20, 2025
@erincatto erincatto self-assigned this Jan 20, 2025
@erincatto
Copy link
Owner Author

Reproduced this in Manifold sample with square vs square and a separation of 0.01

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant