This project has moved and is read-only. For the latest updates, please go here.

BayazitDecomposer.ConvexPartition exception in WP8

Nov 24, 2012 at 3:52 AM
Edited Nov 24, 2012 at 4:37 AM


I was told by a user that one of my wp7 games crashes on wp8 so I did a little digging and found that BayazitDecomposer.ConvexPartition throws the exception:



In the output in visual studio 2012 I see this when launching the game page:

A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in

This causes all of my objects to not have collision so its a really big problem for the game.

The weird thing is that this only happens on real WP8 devices but not the emulator.

Anyone know why this happens?  What can I do to fix this?



Found this in stacktrace

StackTrace = "   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)\r\n   at System.Collections.Generic.List`1.get_Item(Int32 index)\r\n   at FarseerPhysics.Common.Decomposition.BayazitDecomposer.At(Int32 i, Ve...

Nov 25, 2012 at 12:31 AM

The BayazitDecomposer, just like all the other triangulation algorithms are all unsafe to use in live environments. They will crash on certain inputs and Bayazit is one of the more unstable algorithms since it is built by a single man for his school project, and not in a published and peer reviewed paper.

I would recommend you switch to the earclip algorithm. If the vertices you input comes from the users, make sure to clean them up and test if they are simple polygons. Those checks are not made by default for performance reasons.