I'm trying to port the Aether.Physics2D library from C# to Xojo. This is essentially a tweaked version of the Farseer physics engine. It's mostly done 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 multiple 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 (defined here) 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.
No, that's just because it's a class called
Collisionwithin a namespace calledCollision:If you're porting the code anyway, I'd strongly recommend that you fix this mistake.
You could also change the calling code with a
usingdirective:You might want to provide your alias with a different name, actually:
That way the name
Collisiondoesn't change its meaning at all, but you don't need to useCollision.Collisionanywhere.