Box2D Forums

It is currently Sat May 18, 2013 10:56 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Sat Aug 22, 2009 11:36 pm 
Offline

Joined: Fri Aug 21, 2009 8:00 pm
Posts: 60
Hey people, I've just run into a surprising problem whereby using four revolute joints to attach five boxes together into an X shape (with one box in the center, and the hinge points in the corner boxes so that the X is rigid but the corner boxes can spin freely in place) causes enormous, bizarre instability. This X shape is very basic and simple and should not be exploding! What is this about? Is it a known problem? Is it a Box2D problem (as opposed to a JBox2D problem)? I'm doing things in a straightforward fashion, and everything else is working fine for me, so I don't think it's my mistake....


Top
 Profile  
 
PostPosted: Sun Aug 23, 2009 1:10 am 
Offline

Joined: Sun Sep 23, 2007 2:35 pm
Posts: 803
Definitely need more information. Can you post some code that we can test? A picture would probably help, too, to see where you're connecting each of the joints.


Top
 Profile  
 
PostPosted: Sun Aug 23, 2009 7:51 am 
Offline

Joined: Fri Aug 21, 2009 8:00 pm
Posts: 60
I think I described it well enough! :) But here is a picture of the shape, in one of the two Java programs (both mine) where I've seen this shape explode. I drew it a little bit inaccurately to make it clearer where the joints' hubs were. The purple shapes are static obstacles to keep the X from falling (there's gravity). The X explodes pretty fast, for many step-duration values. (That's the .023 down at the right.)

Incidentally, the 14 down at the right is a step-interaction count (the second argument to World.step()). Is 14 an unreasonably low number? I've found that if I crank that up to 40 or so, the explosion mostly goes away, and at 80 or so it seems to stop. But I had the impression that 10 was used in the JBox2D demos... regardless, comparably complex shapes made from distance joints are MUCH more stable than these exes I'm making.

In this thread, a dude links to a sandbox that's made in the D port apparently: viewtopic.php?f=4&t=2756&p=13783&hilit=sandbox#p13783
(search page for "blaze")
I tried drawing my X in that sandbox and it exploded even more easily than it did in my own sandbox. I cut off one leg, and it still exploded. I cut off two legs, and it didn't explode. (I saw all this behavior in my programs as well.)

Do you still want code? I'm telling you, it's as straightforward as it looks--the X explodes pretty reliably, whether it's roughly drawn or placed precisely in code. But I can whip up a small program that neatly demonstrates it if you need me to.

Surely I'm not the first person to draw an X....


Attachments:
exploding X.JPG
exploding X.JPG [ 34.04 KiB | Viewed 2209 times ]
Top
 Profile  
 
PostPosted: Sun Aug 23, 2009 10:46 am 
Offline

Joined: Mon Jun 08, 2009 12:21 pm
Posts: 353
Is this from the release version or from the svn?


Top
 Profile  
 
PostPosted: Sun Aug 23, 2009 12:10 pm 
Offline

Joined: Fri Aug 21, 2009 8:00 pm
Posts: 60
SVN. I just now tried the release version (2.0.1), and saw the same problem.

Looking at the release version reminded me that I wasn't supposed to be using pixel units. And, in fact, at least one of my programs was using pixel units. Embarrassing!

So, still using 2.0.1, I worked in a view scaling and tried to reproduce the X-explosion with various scaling values. I'd started with blocks of width 5 in a square field of width 800; I tried scaling down these dimensions by factors of 10, 100, and 200, and 800. The explosions occurred at all scales.

(Incidentally: Your "IF YOU USE PIXEL UNITS YOU WILL BE SHOT.txt" does a pretty good job of warning against the use of pixel units! But I request a clarifying change in its wording. It says, "Your physics objects should always be roughly between .1 and 10 world-units, which using pixel scale is far too small." What does it mean for physics objects to "be" between .1 and 10 world-units? My 5-pixel-wide boxes in the pixel-unit world had a width in that range, but apparently that's wrong.)


Top
 Profile  
 
PostPosted: Mon Aug 24, 2009 8:20 pm 
Offline

Joined: Fri Aug 21, 2009 8:00 pm
Posts: 60
I've reproduced this in Box2D. I guess you're off the hook now? Here's the thread: viewtopic.php?f=4&t=3611


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

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