Box2D Forums

It is currently Mon May 20, 2013 9:55 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Stacking
PostPosted: Thu Feb 21, 2008 6:37 am 
Offline

Joined: Tue Feb 19, 2008 9:35 am
Posts: 10
Hi,
I'm having some problems stacking some squares. I guess it's because of the time interval, but whenever I stack the objects they fall over. Is there any way to get them to stand still? I tried making friction 1, density 1... Any ideas?

Thanks,

-Danny


Top
 Profile  
 
 Post subject: Re: Stacking
PostPosted: Thu Feb 21, 2008 11:58 am 
Offline

Joined: Mon Dec 17, 2007 10:11 pm
Posts: 185
That's a lot of friction, which might help, but probably isn't what you want as it might make things act "sticky". What is your timestep and # of iterations set to?


Top
 Profile  
 
 Post subject: Re: Stacking
PostPosted: Thu Feb 21, 2008 11:40 pm 
Offline

Joined: Sat Feb 16, 2008 4:45 pm
Posts: 6
I've only played with 2.0 but, when you drop a rectangle with a high restitution straight onto a flat surface, it gets a surprisingly large angular velocity after the bounce. I played around with this a bit and I think it has to do with how the velocity constraints are solved (b2ContactSolver::SolveVelocityConstraints). The angular velocities for the two constraint points (the corners) should cancel each other out. Since the velocities are updated inside the loop you get feedback in the second iteration and the angular velocities don't cancel each other out.

I moved the vel updates for the normal constraints outside the loop and I get straight-up bounces and better stacking behaviour with boxes. The pyramid test with increased gravity (-50) and an iteration count of 20 sticks the landing (before it needed ~35).

Cheers,
Frank.


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

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 3 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