circle goes trough wall

Topics: Developer Forum, Project Management Forum, User Forum
Mar 15, 2011 at 2:01 PM


I use the latest source code and i'm having the problem that my charachter physics can go trough the wall physics, you can feel Its lagging but It goes trough the wall.

I also don't know how to make a physics circle correctly with the latest source because, they don't use fixture anymore?

Is it like


           playerBody = BodyFactory.CreateCircle(WorldPhysX,ConvertUnits.ToSimUnits(1), 1.0f); 
playerFixture = FixtureFactory.AttachCircle(ConvertUnits.ToSimUnits(1), 1.0f,playerBody);
playerFixture.Body.BodyType = BodyType.Dynamic;
playerFixture.Body.Position = new Vector2(ConvertUnits.ToSimUnits(modpos.X) + 0.025f, ConvertUnits.ToSimUnits(modpos.Y) + 0.28f);
playerFixture.Body.Mass = 50;


           playerBody = BodyFactory.CreateCircle(WorldPhysX, ConvertUnits.ToSimUnits(1), 1.0f);
           playerBody.BodyType = BodyType.Dynamic;
           playerBody.Position = new Vector2(ConvertUnits.ToSimUnits(modpos.X), ConvertUnits.ToSimUnits(modpos.Y));

or do it got it wrong?

please help, i'm stuck with this already aa few weeks.

greets ty

Mar 15, 2011 at 10:02 PM

The second part is correct. A body can have several fixtures attached, so the first part is also a valid situation, but probably not what you want.

As for the tunneling, check your timestep and make sure you use meters instead of pixels.

Mar 15, 2011 at 11:36 PM
Edited Mar 16, 2011 at 12:22 AM

thanks, but i'm really stuck with the meters to pixels things. I use the ConvertUnits class, But the debugview doesn't match the position of my objecs in worldspace.

And when i make a


is the value 1meter ? or is is 1cm.
And what are the best values to work with.
The problem is I made a fixture with texture polygon and I can't get the physics correctly in place
because my model is 3D and not just a sprite. :S
I'm really stuck with that that i can't set the physics correctly.

Whats the correct order:

-apply velocity
-change model position with convert to displayunits(bodyposition)
-draw ?


Edit: I tried the timestep things, but It keeps going trough walls with lagging, its really hard for me to check if the physics are on the correct place.
Mar 17, 2011 at 5:50 AM

Try setting the bullet property of your dynamic body to true...this should help with tunneling.

Mar 17, 2011 at 3:25 PM
Edited Mar 17, 2011 at 3:25 PM
KahunaCoder wrote:

Try setting the bullet property of your dynamic body to true...this should help with tunneling.


Still laggy and trough the wall :( but thanks for the suggestion.

What are the sizes I have to use? Like my circle (player) is it ConvertUnits.ToSimUnits(1) ? or is it 100 or 1000 for best performance?


Mar 29, 2011 at 4:09 PM

Sizes are completely up to your needs. There is no fixed scale which fits for any situation. It depends on the size of your (3D) objects, your resolution, your perspective matrix, your view matrix, and probably a dozen other factors. ConvertUnits is meant to convert between physics world units (most likely meters) and pixels i.e. 2D graphics represented via sprites. If you use 3D objects depending on your projection you hardly specify their units in pixels but something else... since 3D projections tend to be resolution independent.

It is impossible to give you any concrete advice, as you don't provide any concrete values. Graphics stuff however is out of the scope of this discussion board anyway. How you map Farseers physics coordinate system to your rendering coordinate system is up to you. Maybe you should start with 2D and sprites before trying to go 2.5D or at least you should try to get a better understanding how 3D graphics and projections in general work, before trying to incorporate Farseer into your game.