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

FPE 3 Basic Body Creation

Topics: User Forum
Sep 30, 2010 at 6:53 PM

Hi everybody, I'm quite a noob in video games physics programming but I'm trying to learn it, and I have some issues with FPE3.

In my game I've added a World and a Camera2D (found on this forum), and specified the camera matrix into the spriteBatch Begin (and debugview view). It seems to work. My problem is that I'm trying to create a game component class that represente the player, with a sprite sheet for 2D animation. It was working well before adding physics (or with FP2). In this class I add a body to the world, and a fixture, with a rectange shape at the same Vector2 Position.

But when I run it with debug view I see both body/fixture and sprite at different positions ... I've tryied to make a convertion from pixels to pixels per meter, but it is not working...

Can you please explain to me how to add a simple body and fixture to a game component ? I've spend a lot of time here looking for tutorial, and I'm not sure that I have well understand how to convert pixel in pixel per meter...


Thanks !

Oct 3, 2010 at 1:34 PM

Take a look at section 1.7 in the Box2d manual and the API/Engine units in the Box2d FAQ. Hope that clears it up.

Oct 3, 2010 at 8:43 PM
Edited Oct 3, 2010 at 8:44 PM

This thread has some useful info for conversion. Look for my post, its the third one.