No collision on Xbox360

Nov 26, 2008 at 11:17 AM
Edited Nov 26, 2008 at 11:21 AM
Hi, I have tried a lot, but I cannot get objects to collide on Xbox360.
First, I could not find a specific version for Xbox360 as in the previous version of Farseer. I converted the Engine only for Xna download, wich was targeted for Windows platform.
I get the test to run and the Player is falling, but never collides. I have tried different collision groups, categories etc.

In Load Content:

physicsSimulator =

new PhysicsSimulator();
physicsSimulator.Gravity =
new Vector2(0, 100);

// Bottom Border
obj = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, 1024, 128, 1);
obj.IsStatic =
obj.Position =
new Vector2(640, 656);
GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, obj, 1024, 128);
// Player Bots
playerBody = new Body[4];
playerBody[0] =
BodyFactory.Instance.CreateRectangleBody(physicsSimulator, 40, 38, 1);
playerBody[0].Position =
new Vector2(640, 500);
Geom pg = GeomFactory.Instance.CreateRectangleGeom(playerBody[0], 40, 38);
pg.CollisionGroup = 1;

then, In Update:
physicsSimulator.Update(gameTime.ElapsedGameTime.Milliseconds * 0.001f);

I'm sorry, but the manual is quite confusing.
I have been looking at the demos mostly for information on how to get started.

Nov 26, 2008 at 12:06 PM
Hi Oakstar.

We removed the Xbox 360 specific version as XNA is cross platform and it's as easy as right clicking on the project and choose to make a Xbox version.

Your problem seems to be that you do not add the geometry (Geom) to the engine.

This line:
Geom pg = GeomFactory.Instance.CreateRectangleGeom(playerBody[0], 40, 38);

needs to be:
Geom pg = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, playerBody[0], 40, 38);

That should be all.

If you have any comments on the manual, please tell us and we will try to improve it for 2.1
Nov 26, 2008 at 1:09 PM
I knew it. It was a silly simple mistake. And I just couldn't find it :)
Thanks for the quick reply.

About the manual. First I know you all are working hard and for free, so don't take this as complaints. More like tips for improvements, especially for beginners.
I really appreciate what you are doing.

I read the manual once again now and I tried to think like this : If I was an absolute beginner, what problems would arise when reading.

It really missed the simple example that was in the previous Documentation page online.
Where I could see a complete, short, working code on one page.
It's much harder to dig through an example Demo code, with ScreenManagers etc

The new manual does not include help on how, where and how often to update the Physics Engine.
physicsSimulator.Update(gameTime.ElapsedGameTime.Milliseconds * 0.001f);
There used to be a good explaination on how this worked also if I remember correctly.

I know how the engine basically works now, but other beginners will probably get into it easier if this was included:
-Image with a tree-like structured showing the layout of a Body with 2 Geometries with different shapes. Geometries overlap, but are in the same Collision group.
This will show how an object is contructed with multiple geometries etc.

-Maybe something more about when creating a Geometry, where will it be located in relation to the Body (Offsets etc).

-Some sections that are mostly "behind the scenes" workings, or advanced stuff should preferably be grouped together further back in the manual,
so all beginner information could be read continously from the beginning.

That's all I can think of right now.


Nov 26, 2008 at 3:53 PM
Thanks for the suggestions Oakstar. I appreciate your feedback on the manual.

1. I tried to simplify the samples to make sure that beginners could follow it, without having too much of a compromise with the game design. I also tried to explain a little about the relation between bodies and geometries, but I guess a simple demo (without drawing helpers, screenmanagers and the like) would be good demonstration of the simplicity of Farseer Physics. I'll write it down.

2. The timing of the engine is really up to the game developer. But then again, we could include some information about it, just to be sure.

3. Good idea. I'll write it down.

4. Indeed. While offsets are not the most advanced feature we have :) a simple explanation does not hurt anyone.

5. We tried to make the manual as versatile as possible. We made sure that both beginners and advanced users could gain something from reading the manual. It's hard to find the perfect balance between making it as easy as possible, and making sure that nothing important is left out.
The order of sections are made in such a way, that when we write about collision detection, the AABB, narrow phase and broad phase are the next ones. I'll have a look at it for 2.1.

Thanks again for your suggestions. We hope you have had some fun with our engine :)