Hi team, thanks for the great work and congratulations on the successful release of FPE 3.0.
This discussion is about an exception that
some experienced with FPE 3.0 in Silverlight. The following solution may save few people some time when the following exception is thrown. This happens when FPE 3.0 runtime gets loaded:
Illegal layout for type 'FarseerPhysics.Collision.ContactID' from assembly 'Farseer Physics 3.0 Silverlight, Version=3.0.3900.2038, Culture=neutral, PublicKeyToken=null': valuetypes with non-public fields may not overlap with
This is caused by "ContactFeature" structure (in file: Farseer Physics Engine 3.0 Silverlight\Collision\Collision.cs) having non-public data members. Changing all four data members of "ContactFeature" to "public" resolves
public struct ContactFeature
/// Feature index on ShapeA
public byte IndexA;
/// Feature index on ShapeB
public byte IndexB;
/// The feature type on ShapeA
public byte TypeA;
/// The feature type on ShapeB
public byte TypeB;
That way, we can keep the struct layout of "ContactID" so it continues to be accessible from C++ codes.
Hope that makes sense and help a few people. Again, thanks for offering such a great physics engine for free, if I ever get to make money from this, I'll make sure I donate some cash for the funding.