Trouble with triangles

Sep 15, 2009 at 3:20 PM

Hello,

Firstly I must apologize for even making this post, I know for sure that this will be user error but I'm after a little guidance if you will.
I have a very simple setup and I am using SAT.

- A floor
- A circle
- A triangle

what i want to happen is for the circle to fall under gravity collide with the circle and roll, or reflect of at the correct angle when it hits the triangles lovely angular surface.
my triangle is part of the background texture so its important i position the geometries for the background in the correct place. (the background isn't bound to the geometries)

to create the triangles body and geometry i used CreatePolygonBody() and CreatePolygonGeom() methods respectively.

my triangle is a right angle triangle, 100 pixels high and 50 pixels wide.  i made a list of vertices to pass as parameters into the class and used the following Vector2D's
(0,0) , (50,100) , (0,100)

i would imagine the new geometries point of origin would be in the center of the triangle, so if i set its position with something like
myTriangle.Position = new Vector2d(400,400) that the 25th pixel on the triangles x axis and the 50th pixel on the triangles y axis would be positioned here with the rest of the triangle around it.

this is not the case however.  if i then run my app, the circle falls and bounces as if the triangle is a fair bit higher than where i imagined it would be
what have i got wrong?

thanks in advance.

Sep 15, 2009 at 8:43 PM

Using the PhysicsSimulatorView in the samples should help you figure out where everything is. If you're coding in a sample application, pressing F1 should toggle the debug view.