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

Farseer Engine Not Processing Bounce

Topics: Developer Forum, User Forum
Nov 9, 2010 at 7:46 PM


I've been in contact with Matt for a week or so and he has been giving me a hand with the Farseer engine and a Camera class. Everything looks good, but the physics engine seems to have quit.  

For example I have a circle colliding with a pentagon I made from a texture to Figure process. The ball before the updating and scaling bounced off perfectly. (note my game has no gravity) When it collides now, the ball sticks to the pentagon and slides across it until it stops touching it. It then proceeds to continue at the same angle until it hits another object and glides across that. I set all my objects to have no friction and a 1.0f restitution.

Any thoughts?



Nov 9, 2010 at 8:08 PM

Can you provide a testbed sample that shows the problem?

Nov 10, 2010 at 12:00 AM

Got a basic collision in there. Is It something I didn't supply or something I did that messed it up?

Nov 10, 2010 at 12:35 AM

I referred to the TestBed test framework that comes with FPE 3.0. The reason I would like a sample inside that framework instead of in something you created, is that if you can reproduce the error in the testbed, it is something wrong with the engine and not your code. - Also, it is easier to find a problem with the code you created.

Anyway, I compiled your sample and there are a couple of things you should take a look at.

1. The texture you supply is already convex - no need to decompose it.

2. You are doing a lot of work two times. You are creating the texture data array twice and converting it to a vertices array twice. Not really a problem, but no need to clutter your own code with nonsense.

3. You might want to start out creating your game in the TestBed or use the SimpleSamples framework to get the feel of FPE. Once you get the basics working, you can move it to a project of its own. Like you are doing now, you need to convert between physics and screen coordinates. You can take a look at Matthews sample on how to do that.

Nov 10, 2010 at 3:44 AM
Edited Nov 10, 2010 at 4:18 AM

Well i'll work on getting it into the test bed. But I would like to say that i can't make the polygon without decomposing it. I've tried, i read countless questions on this board and it just won't work without it. Convex or not :( .

The "Matthews sample" thing doesn't want to work in either VS 2010 or VS 2008...any way to work around?

EDIT: Alright i got it into the test bed and everything works. Although I thought that would work because everything just stopped working after i changed my game to have the camera.

Nov 10, 2010 at 12:35 PM

Matthews sample uses XNA 4.0. You should also be using 4.0 as Farseer Physics Engine 3.1 will be released for XNA 4.0.

Nov 10, 2010 at 2:05 PM

XNA 3.1 will go offline in 30 days. Unless you are finishing your game in the next week switch to 4.0. I use VS 2010, you can simply add all the source files to a new project in VS Express and add Farseer Physics Reference and the Content and it should work fine. If you have trouble I will post up a copy for your version of VS.

Nov 11, 2010 at 7:56 PM

Okay there are some things i think i'm confusing here. The game was working before the camera change and not after, so there must be something wrong with the camera and not my game's engine itself. As I tested in the testbed, it worked fine because my camera class was missing.

When will Farseer Physics 3.1 be out because in the mean time i can't test my game then.

It seems the Debug class doesn't work in XNA 4.0 so i can't visually test things that well.