novialriptide / Reign.Physics2D

Just another fork of Farseer Physics.
https://physics.reigngame.net/
Other
0 stars 0 forks source link

Allow applying modifications to a `Fixture` onto an existing `Body` without any interruptions to the physics simulation during runtime. #4

Open novialriptide opened 11 months ago

novialriptide commented 11 months ago

Allow applying modifications to a Fixture onto an existing Body without any interruptions to the physics simulation during runtime.

Since I have an entity component system within the Faraway.Engine project that has a Transform component that takes in parameters such as Position and Rotation, Scale is omitted as there is no clean solution on implementing a resize method on game objects with the BoxCollider2D component.

Example Physics2D Code

Body body = new Body();
Vertices vertices = PolygonTools.CreateRectangle(5, 5, new Vector2(5, 5), 0);
Fixture fixture = new Fixture(new PolygonShape(vertices, 1.0f));
body.Add(fixture);

// `FixtureList` is a read-only attribute as of now. It won't be exactly like this as
// `FixtureList` is actually a `FixtureCollection`, but it'll be something similar.
body.FixtureList = new List<Fixture>();