Box2D Forums

It is currently Wed May 22, 2013 3:09 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 15 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Tue Jan 31, 2012 11:15 am 
Offline

Joined: Sun Dec 25, 2011 3:41 pm
Posts: 18
This video explains my problem:
http://www.youtube.com/watch?v=ORQrS56pGpA

What is causing this?

I fixed one of the walls by tweaking its coordinates slightly:
from this
{0,910} , {630,910} , {630,1000} , {0,1000}
to this
{100,910} , {630,910} , {630,1000} , {100,1000}

Intersecting static bodies doesn't seem to cause this problem. It's something much more mysterious, since I just shortened the wall slightly to make it work.

Please help!


Top
 Profile  
 
PostPosted: Tue Jan 31, 2012 10:08 pm 
Offline

Joined: Tue Jun 24, 2008 8:25 pm
Posts: 1515
Location: Tokyo
Wow weird. Is that a 'debug draw' rendering of the scene?


Top
 Profile  
 
PostPosted: Wed Feb 01, 2012 6:43 am 
Offline

Joined: Sun Dec 25, 2011 3:41 pm
Posts: 18
Yes.
I use Slick 2D for rendering.


Top
 Profile  
 
PostPosted: Wed Feb 01, 2012 7:34 am 
Offline

Joined: Sun Dec 25, 2011 3:41 pm
Posts: 18
Ok, I got one of the walls working by changing the position of the body's origin.
It seems like the origin must be inside the body, even if it's a static one.
Image

But I find it weird that some (actually most) of the walls I've created the wrong way do work.
I'd like to see someone else to replicate this problem, and find a solid solution for it.


Top
 Profile  
 
PostPosted: Wed Feb 01, 2012 9:02 am 
Offline

Joined: Tue Jun 24, 2008 8:25 pm
Posts: 1515
Location: Tokyo
I can see from your scene that you are no newbie, but just in case... is the polygon wound the right way?


Top
 Profile  
 
PostPosted: Wed Feb 01, 2012 10:02 am 
Offline

Joined: Sun Dec 25, 2011 3:41 pm
Posts: 18
I might be a newbie since I don't understand what you mean by "polygon wound" :P

Do you mean if the corners of the polygon are read in the correct order, like, clockwise or counterclockwise?
Yes, I think I'm creating the polygons the right way, as far as that goes.


Top
 Profile  
 
PostPosted: Wed Feb 01, 2012 11:30 am 
Offline

Joined: Tue Jun 24, 2008 8:25 pm
Posts: 1515
Location: Tokyo
Yeah that's right. This sounds like a bug somewhere. The only thing that is a little unusual is the large sizes of your dimensions but it should still work ok.
Is this an up-to-date version? I seem to recall toucansam updated the java port recently, maybe you could check into that.


Top
 Profile  
 
PostPosted: Wed Feb 01, 2012 12:23 pm 
Offline

Joined: Sun Dec 25, 2011 3:41 pm
Posts: 18
The dimensions are large because I give them as pixels (when zoom is in 1:1 ratio), but then I have a method to convert the dimensions into smaller values so that it's fine for JBox2D. I have a very recent version of the Java port, and I don't think such a huge and obvious bug could be in the port. The problem must be in the way I use it.

Have you tried to make a static body where the origin is far away outside of the body?
For instance, if the origin is at 0,0 then the actual shape would be somewhere around 10,10 which is a huge offset in JBox2D's coordinate system.

I don't know if the origin (that is used when a body is created) is used for the collision detection at all, but at least by tweaking it I managed to fix one of the walls.


Top
 Profile  
 
PostPosted: Thu Feb 02, 2012 1:28 pm 
Offline

Joined: Tue Jun 24, 2008 8:25 pm
Posts: 1515
Location: Tokyo
The location of the body's reference point aka location should not make any difference, especially for static bodies. It's more likely that the locations of the fixture itself that has relevance...
Are you able to narrow this down to a very small test case that shows these symptoms? You might be able to get that nice person 'Somebody' to look at it. It seems like something that should be looked at. I still have my doubts that it is happening in the C++ version.


Top
 Profile  
 
PostPosted: Sat Feb 04, 2012 8:32 pm 
Offline

Joined: Mon Jun 08, 2009 12:21 pm
Posts: 353
can you verify which version of the engine you're using?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ]  Go to page 1, 2  Next

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group