Everything seemed to work perfectly until I did a .NET Native build. That's when I started getting a System.IndexOutOfRangeException in IntertiaHelper.GenerateSphere(). After spending hours investigating this, it turns out that the calls to edges.TryGetValue() are not working as expected i.e. it is returning false for edges that have already been added to the edges Dictionary (but only in a .NET Native build).
Finally I came across this piece of documentation that helped me find a solution. https://msdn.microsoft.com/en-us/librar ... .110).aspx. The relevant bit being...
I saw that TriangleMeshConvexContactManifold.Edge implements IEquatable but does not override the base class Object.Equals() so I provided an implementation as follows:If you implement IEquatable<T>, you should also override the base class implementations of Object.Equals(Object) and GetHashCode so that their behavior is consistent with that of the IEquatable<T>.Equals method.
Code: Select all
public override bool Equals(object obj)
{
return this.Equals((Edge)obj);
}
I'm not sure if this is a .NET Native bug or BEPU Physics bug but I hope this is helpful.