Box2D Forums

It is currently Thu May 23, 2013 4:09 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Tue Jul 17, 2012 7:42 am 
Offline

Joined: Tue May 18, 2010 1:17 pm
Posts: 19
I've made an editor for a game I'm producing, the problem is that when the level starts there's movement as the level settles or the bodies either slightly fall into each other and then pop back out. I've added a function which allows me to run the simulation for a while until the level is settled but when I start the level I still get the penetration issue. I've done some searching but can't find much, has anyone come across this problem before? Is there a solution?

Thanks,


Top
 Profile  
 
PostPosted: Tue Jul 17, 2012 2:56 pm 
Offline

Joined: Fri Jul 06, 2012 9:33 pm
Posts: 5
Why not run the simulation as fast as possible (independent of frame rate, without rendering) for a bit as the last stage of "loading"?


Top
 Profile  
 
PostPosted: Wed Jul 18, 2012 8:30 pm 
Offline

Joined: Tue Sep 25, 2007 2:22 pm
Posts: 483
You'll need to create a tool that loads a level, settles it, and saves it back to disk.


Top
 Profile  
 
PostPosted: Sun Jul 29, 2012 1:13 am 
Offline

Joined: Fri Jul 06, 2012 9:33 pm
Posts: 5
pTymN, the OP said that he already does this (probably within the editor, since there's no reason to use a separate tool).

His problem (as I understand it) is that when he loads a pre-settled level the dynamic objects all penetrate slightly and then everything pops back out of the ground.

My guess would be that Box2D stores state regarding settled bodies and their points of contact, and this state is lost when the level is re-loaded and the bodies are re-created.

The solution I offered was simply to quickly "re-settle" the level by running the simulation "behind the scenes" at the last stage of loading, before presenting it to the user.


Top
 Profile  
 
PostPosted: Sun Jul 29, 2012 8:55 am 
Offline

Joined: Tue Jun 24, 2008 8:25 pm
Posts: 1517
Location: Tokyo
I'm not really sure if it would help, but you could try running one step with a timestep of zero - afaik that would set up the contacts again but without actually moving anything.


Top
 Profile  
 
PostPosted: Sun Jul 29, 2012 5:52 pm 
Offline

Joined: Tue Sep 25, 2007 2:22 pm
Posts: 483
The binary file could also contain the warm starting values, this is the first culprit I can think of.


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