none square rectangle not colliding properly

Posts regarding potential bugs, enhancement requests, and general feedback on use of dyn4j
codifies
Posts: 2
Joined: Fri Aug 28, 2015 9:19 am

none square rectangle not colliding properly

Postby codifies » Fri Aug 28, 2015 10:03 am

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!!??

William
Site Admin
Posts: 351
Joined: Sat Feb 06, 2010 10:23 pm

Re: none square rectangle not colliding properly

Postby William » Sat Aug 29, 2015 12:44 am

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

codifies
Posts: 2
Joined: Fri Aug 28, 2015 9:19 am

Re: none square rectangle not colliding properly

Postby codifies » Sat Aug 29, 2015 9:49 am

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....


Return to “Bugs, Enhancements, Feedback”

Who is online

Users browsing this forum: No registered users and 1 guest