Penetration problems FP 3.1

Topics: Developer Forum
Nov 20, 2010 at 10:29 PM

Hi

Now I managed to resovle my graphical port problems when moving from FP 2.x to FP 3.1

But now I have a new issue where collisions do not always occur and some times it takes a while for Farseer to compensate and resolve the issue where several polygons are penetrating each other.

I tried to recompile Farseer without CCD but it doesn't improve the situation.

Is there anything else I should try to improve the situation?

I've read that using too large units can cause problems and at the moment my polygons are 300px X 300 px which is not very good for FP 3.1 as I understand it but I don't think that this issue is caused by that problem.

 

Coordinator
Nov 20, 2010 at 10:32 PM

Dynamic 300x300 meters objects are not going to simulate well. You should take a look at the samples on how to scale your units. Farseer does not work well with bad data.

Nov 20, 2010 at 11:52 PM

Ok yes so now I use the ConvertUnits (size reduces by 10x to 30x30) class but still polygons don't perform as expected.

They sometimes collid properly but then sometimes they sink into eachother.

Here is an image of the result: http://www.casualgames.nu/images/strangeFarseer.jpg

The white box should not fall through the other polygon and the asteroid should not fall through the white polygon ½ way.

 

Coordinator
Nov 21, 2010 at 1:19 AM

Again, make sure to check out the samples and how they do it. What kind of density values are you using?

Nov 21, 2010 at 5:52 PM

I've been trying different values for density both small and large but it doesn't make a difference when it comes to this problem.

I've been looking at the samples but I can't seem to find one that uses custom Polygons, do you have one that I can look at?

When using regular shapes I don't seem to have this problem so its something related to the polygon.

Nov 21, 2010 at 11:05 PM

Ok I got a little but further.

Found a good example in the testBed: TextureVerticesTest.

 In this example the function CreateCompoundPolygon is used instead.

BUT when I scale my graphic files I sometimes get a crash in the CDTDecomposer.ConvexPartition with the message: "EdgeEvent - Point on constrained edge not supported yet".

Any idea of how to get around this or a better way to divide my polygon into a fixture list?

Coordinator
Nov 21, 2010 at 11:08 PM

You simply have to use one of the other decomposers that can handle your data.

You can use BayazitDecomposer, EarclipDecomposer or the FlipcodeDecomposer. See which one that fit your needs the best.

Nov 21, 2010 at 11:22 PM

Thanx!

Just figured that out too :)

So now I'm using BayazitDecomposer.ConvexPartition and it works great!

And the performance seems awsome so great work Genbox and the rest of you who work on the engine!

BTW do you want my project as a very basic example of how to get started with Silverlight and Farseer.
The current examples for silverlight is a bit complex to follow and get started with (or at least it was for me).

 

Coordinator
Nov 21, 2010 at 11:29 PM

The more samples I add, the more projects I have to handle, refactor, compile and so on. It is a huge workload, so I'm trying to keep the official samples as few as possible. But I do think your are right and you are welcome to write a guide together with your sample. I can add you as an editor to the project and you will be able to write and upload files to our wiki.

Nov 22, 2010 at 8:14 PM

Sure I can do that!

I'm just happy to be able to assist you with getting people started :)

Coordinator
Nov 22, 2010 at 8:37 PM

I've added you as an Editor. You should be able to create and edit the wiki now. You are pretty much left on your own for the moment, but if you have any questions or need any help, let me know and I'll get back to you when I can.

Dec 19, 2010 at 7:26 PM

Hi Genbox,

Sorry about the delay. Have had heaps of stuff todo and learnt a few new things that improved this sample.

I'm trying to figure out how Codeplex works but I guess I should create a new page for this sample.

However I cannot add it to the download section so if you want to do here is the file:

http://www.casualgames.nu/Download/PolygonHelloWorld.zip

Coordinator
Dec 19, 2010 at 9:10 PM

You create a new wiki page and there you should be able to upload the sample.

I've created an URL to a Wiki page called Hello World In Silverlight. You can see the link here. You simply click the link and click edit. That should create the wiki page and you are free to edit everything on it + upload files. If you have any trouble, let me know.