Add pyramid physics testbed (#3710)

* Add pyramid physics testbed

From Box2D (licence is already on the file). Useful for testing solver performance for large islands.

* nulls

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2021-03-28 13:41:49 +11:00
committed by GitHub
parent b65157ea0f
commit bc6a93fa02
2 changed files with 62 additions and 11 deletions

View File

@@ -64,8 +64,7 @@ namespace Content.IntegrationTests.Tests.Physics
var entityManager = IoCManager.Resolve<IEntityManager>();
// TODO: Need a blank entity we can spawn for testbed.
var ground = entityManager.SpawnEntity("BlankEntity", new MapCoordinates(0, 0, mapId)).AddComponent<PhysicsComponent>();
var ground = entityManager.SpawnEntity(null, new MapCoordinates(0, 0, mapId)).AddComponent<PhysicsComponent>();
var horizontal = new EdgeShape(new Vector2(-20, 0), new Vector2(20, 0));
var horizontalFixture = new Fixture(ground, horizontal)
@@ -98,7 +97,7 @@ namespace Content.IntegrationTests.Tests.Physics
{
var x = 0.0f;
var box = entityManager.SpawnEntity("BlankEntity",
var box = entityManager.SpawnEntity(null,
new MapCoordinates(new Vector2(xs[j] + x, 0.55f + 2.1f * i), mapId)).AddComponent<PhysicsComponent>();
box.BodyType = BodyType.Dynamic;
@@ -181,8 +180,7 @@ namespace Content.IntegrationTests.Tests.Physics
var entityManager = IoCManager.Resolve<IEntityManager>();
// TODO: Need a blank entity we can spawn for testbed.
var ground = entityManager.SpawnEntity("BlankEntity", new MapCoordinates(0, 0, mapId)).AddComponent<PhysicsComponent>();
var ground = entityManager.SpawnEntity(null, new MapCoordinates(0, 0, mapId)).AddComponent<PhysicsComponent>();
var horizontal = new EdgeShape(new Vector2(-20, 0), new Vector2(20, 0));
var horizontalFixture = new Fixture(ground, horizontal)
@@ -215,7 +213,7 @@ namespace Content.IntegrationTests.Tests.Physics
{
var x = 0.0f;
var circle = entityManager.SpawnEntity("BlankEntity",
var circle = entityManager.SpawnEntity(null,
new MapCoordinates(new Vector2(xs[j] + x, 0.55f + 2.1f * i), mapId)).AddComponent<PhysicsComponent>();
circle.BodyType = BodyType.Dynamic;