Differences with FP2 and 3?

Topics: User Forum
Sep 29, 2010 at 8:23 PM

In the past I VERY briefly used FP2. I created geometries and made them collide. I see that there geometries are no more. So what is a fixture and a body?
And finally, when drawing, I need to know the width and height of a fixture(so i know how big to draw the texture), where do I get that? I can only find the position in fixture.Body.Position.


Thanks :-)

Sep 29, 2010 at 8:29 PM

A fixture is what fix a body and shape together. You can create a fixture directly using the FixtureFactory or by create a fixture object manually. The parameters you give to the FixtureFactory determines the size the of the shape. The unit is meters, so you will have to do some conversion between physics units (meters) and display units (pixels).

Sep 29, 2010 at 8:37 PM

Ok, so _circleFixture = FixtureFactory.CreateCircle(_world, 2, 1, new Vector2(170, 200)); will create a circle with a radius of 2 metres?

a) How do i convert that to pixels

b) How do I retrieve the size of fixtures after creating them?

Sep 29, 2010 at 8:41 PM
Edited Sep 29, 2010 at 8:47 PM

a) You create your own conversion between meters and pixels. There are quite a few threads on the forum now that explains what to do.

Edit: Like here and here

b) You can access the Shape object using Fixture.Shape.

Sep 29, 2010 at 8:51 PM

Thanks for the links!

Sorry for being an idiot, but in Fixture.Shape the only thing I can see that is relevant is radius, but that doesnt help when the shape is a rectangle

Sep 29, 2010 at 8:57 PM

Fixture.Shape contains radius of the circle and it even has a radius when it is a polygon, but the radius is not what you would expect. If you created a rectangle, then you can store the dimensions of the rectangle inside Fixture.UserData.

I would recommend using a drawing system like the one in the samples. You send the vertices to the graphics card and it draws all your stuff using the supplied view and projection matrix.

Sep 29, 2010 at 9:06 PM

Oh ok great!

Thanks for the speedy responses!

p.s. I cannot use projections or pretty much any of the drawing from the examples because I am using a ZuneHD which does not support them. This also means I cannot use the Drawing Debug project.