Aether.Physics2D - Release v 1.0 - 1.7

@nkast Amazing work on this library!

I’m trying to port it to a different language (Xojo) but there’s one part of the source code that I can’t work out (it may be because C# is not my main language).

In Dynamics/Contacts/Contact.cs there are references to what looks like a global Collision object but I can’t find it’s definition. For instance, on line 405, in the switch:

case ContactType.Polygon:
  Collision.Collision.CollidePolygons(ref manifold, (PolygonShape)FixtureA.Shape, ref transformA, (PolygonShape)FixtureB.Shape, ref transformB);
  break;

I have already ported the Collision class and its CollidePolygons static method but why is this code not just:

Collision.CollidePolygons(ref manifold, (PolygonShape)FixtureA.Shape, ref transformA, (PolygonShape)FixtureB.Shape, ref transformB);

Instead of:

Collision.Collision.CollidePolygons(ref manifold, (PolygonShape)FixtureA.Shape, ref transformA, (PolygonShape)FixtureB.Shape, ref transformB);

Essentially, why are there two Collision calls?

Any help is greatly appreciated.

Thanks so much! I need this, Farseer was deprecated.

:blush:

1 Like

Hi, there a question. Is for your engine something like documentation, i started to learn monogame newly and want to get something bigger that only forum.

Aether.Physics2D v1.5

In this Release:

  • Fix Serialization. Use InvariantCulture for serializing/deserializing.
  • Fix QuadTree RayCast. (Thanks @ldelgiud!)
  • World.Gravity is now a Property and throws InvalidOperationException if set during stepping.
  • Delegate QueryCallback renamed to QueryReportFixtureDelegate to match box2d.
  • Delegate RayCastCallback renamed to RayCastReportFixtureDelegate to match box2d.
  • DebugViewBase and DebugViewFlags moved to Diagnostics.
  • Improve memory allocation of internal buffers.
  • Internal callbacks for Query/RayCast are cached.
  • The following methods were marked obsolete:
    new World(AABB span)
    List QueryAABB(ref AABB aabb)
    List RayCast(Vector2 point1, Vector2 point2)
    List TestPointAll(Vector2 point)
  • The following methods were Removed (Deprecated in version 1.2)
    Body.IsStatic
    Body.IsKinematic
  • Added support for netstandard2.0.
  • Added standalone library without dependencies to monogame. (net40 & netstandard2.0)

From v1.5 the nuget package Aether.Physics2D contain the standalone library with no dependencies to 3rd party math libraries (microsoft.XNA.Framework.Vector2).

Standalone: https://www.nuget.org/packages/Aether.Physics2D

The monogame based library and the monogame based diagnostics were moved to Aether.Physics2D.MG and Aether.Physics2D.Diagnostics.MG. To upgrade to the new version please replace the nuget reference with the new one. Sorry for this inconvenience.

https://www.nuget.org/packages/Aether.Physics2D.MG
https://www.nuget.org/packages/Aether.Physics2D.Diagnostics.MG

v1.5 release info

4 Likes

Aether.Physics2D v1.6

In this Release:

  • Fix Body.Revolutions (Thanks @jaimeadf!)
  • Thread safe events/callbacks
  • The following properties are now read-only collections:
    Body.FixtureList, World
    World.BodyList
    World.JointList
    World.ControllerList
  • Added Joint.World property
  • Added DebugViewFlags.None flag
  • The following methods/properties were marked obsolete:
    Body.IslandIndex
    Body.SetRestitution(…)
    Body.SetFriction(…)
    Body.SetCollisionCategories(…)
    Body.SetCollidesWith(…)
    Body.SetCollisionGroup(…)
    Body.SetIsSensor(…)
  • The following methods/properties were Removed
    World.IsStepping (Deprecated in version 1.3)
    World(AABB span) (Deprecated in version 1.5)
    World.QueryAABB(ref AABB aabb) (Deprecated in version 1.5)
    World.RayCast(Vector2 point1, Vector2 point2) (Deprecated in version 1.5)
    World.TestPointAll(Vector2 point) (Deprecated in version 1.5)

Standalone:
https://www.nuget.org/packages/Aether.Physics2D
Monogame:
https://www.nuget.org/packages/Aether.Physics2D.MG
https://www.nuget.org/packages/Aether.Physics2D.Diagnostics.MG
Documentation:
https://tainicom.github.io/Aether.Physics2D/
Discord: https://discord.gg/95nPEjZ6mu

2 Likes

Aether.Physics2D v1.7

In this Release:

  • fixed Complex.Negate()
  • fixed Complex.Magnitude
  • Complex.Real & Complex.Imaginary fields renamed to Complex.R & Complex.i
  • added generic DynamicTreeBroadPhase.
    You can now use the BroadPhase independently from the physics engine for simple collision checks
  • removed QuadTreeBroadPhase class
  • removed World.Fluid property
  • removed MathUtils.InvSqrt(…)

Standalone:
https://www.nuget.org/packages/Aether.Physics2D
Monogame:
https://www.nuget.org/packages/Aether.Physics2D.MG
https://www.nuget.org/packages/Aether.Physics2D.Diagnostics.MG
Documentation:
https://tainicom.github.io/Aether.Physics2D/
Discord: https://discord.gg/95nPEjZ6mu

3 Likes

Hey @nkast .

I´ve started to implement Aether.Physics2D on my game after dabbling a bit with Farseer. I have a quick question that is confusing me a little bit:

The ConvertUnits was removed. An orthographic camera (View&Projection) is preferred for rendering your Physics world.
You can find ConvertUnits here and copy it in your project if you find it useful.

Without the ConvertUnits the default display units to sim Ratio is 100f? because I used to set it to 64 pixels per meter due the size of my sprites.

Sorry if my question is dumb, I´m just getting used to implementing the engine and I’m having some troubles setting the sizes of the bodies to match the sprites sizes, resulting in wierd collisions probably due to bodies overlapping

The library doesn’t do any conversion. ConvertUnits was simply a multiplication with a factor.
This is something you do in the draw method, and you choose your own units to sim, or dpi.
Preferably you can incorporate this into your camera view matrix if you implement resolution independent rendering.

1 Like