I am working on a Windows Phone 7 game which uses the Physics Helper library for basic physics and collisions in my game.
I am raising this thread in the farseer forum because I think the exception that I am getting is related to Farseer, which is what Physics Helper uses.
The game consists of a couple of marbles on the screen. Each marble is basically a Rectangle with its Fill property set to an ImageBrush, and I've set the BoundaryObject to an ellipse for proper collisions.
The game has a new button, and everytime the user presses the new button, existing marbles on the screen are cleared, the corresponding physics objects are deleted, and a random number of marbles are added back. The number of marbles varies between 4-8.
Now, the game works nicely most of the times but if I keep pressing the new button continuously 10-15 times, the whole physics system breaks down. And sometimes I get the below exception,
Silverlight AppDomainAssertAssertion Failed
at DefaultTraceListener.AssertFailure(String File, Int32 Line, String Expr)
at DefaultTraceListener.Fail(String message, String detailMessage)
at DefaultTraceListener.Fail(String message)
at TraceInternal.Fail(String message)
at TraceInternal.Assert(Boolean condition)
at Debug.Assert(Boolean condition)
at Island.Add(Joint joint)
at World.Solve(TimeStep& step)
at World.Step(Single dt)
at PhysicsControllerMain.CompositionTarget_Rendering(Object sender, EventArgs e)
at CompositionTarget.OnRendering(Object sender, RenderingEventArgs e)
This exception doesn't happen always, but with or without it, the game gets screwed. I can't move the marbles anymore, the objects become unresponsive and they keep kinda shivering in their place.
The new button is actually an Image and I am handling the Manipulation_Started and Manipulation_Completed events on it. I make sure that if a current New button click is in progress, and the next manipulation completed event happens before the processing
of previous click is complete, I just return from the function, without doing anything.
Has anyone seen this error or behaviour before?
Unfortunately, I cannot share the code here. Sorry.
Thanks for your help.