Page 1 of 1

none square rectangle not colliding properly

Posted: Fri Aug 28, 2015 10:03 am
by codifies
Not convinced this isn't my fault! but here goes...

if I have boxes 0.5, 1.0 or 2.0 square they collide fine with everything

if they are not square (2.0,1.0 say) they collide fine with each other, but other shapes (circle, polygon) don't collide properly they interpenetrate in an odd way I can't seem to see any rhyme or reason to how other fixtures are colliding with them

I've tried with the jar and also by including the github source and both behave the same

I'm scaling to 64px == 1 physics unit == typical sprite width ( a fixture 2,1 is 128px,64px )

any ideas what's going on!!??

Re: none square rectangle not colliding properly

Posted: Sat Aug 29, 2015 12:44 am
by William
Can you confirm that you are rendering appropriately? I've had something like this happen to me and it was because I wasn't rendering the position, size, and rotation correctly, so it looked like it wasn't working.

If not, can you reproduce with a simple example using the ExampleGraphics2D/Graphics2DRenderer classes?

William

Re: none square rectangle not colliding properly

Posted: Sat Aug 29, 2015 9:49 am
by codifies
Doh! it was my fault... I'll detail my embarrassment, just in the hope it might helps someone else...

so remember "square" shapes (ie width==height) were working just fine....

pity I'd forgotten to set each sprites drawing origin to the centre of the image everything looks and collides just fine when everything is square or circular....!

of course first thing I suspected was my scaling the Y axis negatively (I guess I should just really change gravity!) so I spent a while messing with that

*then* I cloned it and dropped in jbox2d for the physics.... Waaaaaa it was doing the same thing!.. but at least then I knew then it *was* a graphics issue....

took an embarrassingly long time for it to dawn on me it was the image origin....