# Box2D Forums

 It is currently Fri May 24, 2013 11:18 pm

 All times are UTC - 8 hours [ DST ]

 Page 1 of 1 [ 6 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Zero gravity, Circle shape gets stuck to wallPosted: Wed Dec 16, 2009 1:05 pm

Joined: Thu Oct 29, 2009 7:58 am
Posts: 10
Hi I have a slight problem with box2d
I am not sure if this is a bug, or a property of newtonian physics but it would be really nice if you could help me get this to work.

My problem is basically when a circleShape is as close to a wall (2 polygon edge) as possible and another circle shape hits it, it does not move from the wall.
This effect can be seen in the varying restitution example, when gravity is disabled and you put 1.0 restitution ball on the ground and throw the others at it.

The effect I want is similar to when in pool, and one ball lies and touches an edge, and another ball hits it hard enough the both leave the edge.

I have tried a few things like increasing the restitution above 1 on the edge but when there is exactly no space between the circle and edge, the ball just moves along the same axis as the edge.

Any help would be greatly appreciated.

Update: I fixed this with a small "hack", by applying a small impulse on this particular object on collisions, this of course applies to all collisions with this particular object but seems to work for my case. Further comments are well appreciated though.

Top

 Post subject: Re: Zero gravity, Circle shape gets stuck to wallPosted: Thu Apr 08, 2010 9:57 am

Joined: Thu Apr 08, 2010 9:33 am
Posts: 2
hello everyone,
im having the same problem. i found this in the documentation:
Quote:
Box2D also uses inelastic collisions when the collision velocity is small. This is done to prevent jitter.

this causes my ball-objects to get stuck on one of the four borders after some minutes.

<EDIT>
Problem solved

Last edited by iasonf on Thu Apr 08, 2010 1:05 pm, edited 1 time in total.

Top

 Post subject: Re: Zero gravity, Circle shape gets stuck to wallPosted: Thu Apr 08, 2010 1:04 pm

Joined: Thu Apr 08, 2010 9:33 am
Posts: 2
i searched the forum again and found the solution
http://box2d.org/forum/viewtopic.php?f=8&t=2630&p=13522&hilit=sticking+to+walls#p13522.

Just Change b2_velocityThreshold to 0 in b2Settings

Top

 Post subject: Re: Zero gravity, Circle shape gets stuck to wallPosted: Tue May 08, 2012 5:30 am

Joined: Mon May 07, 2012 8:39 pm
Posts: 3
I'm having a similar problem.

Setting b2_velocityThreshold does help, but does not fix the issue, especially when the collision's overlap is too great: the circle actually begins tunneling through the polygon. Going to try the impulse method. (I have to admit to being a little disappointed though - setting up a contact listener and retrieving normal vectors... I got into Box2D to avoid dealing with the details physics implementation like this.)

Top

 Post subject: Re: Zero gravity, Circle shape gets stuck to wallPosted: Tue May 08, 2012 6:54 am

Joined: Mon May 07, 2012 8:39 pm
Posts: 3
Just wanted to share a solution I found to this problem: make sure you define polygon regions by vertices in the same order across your world. I used all clockwise orientations for most of them, except 2 which were done counterclockwise, and invariably the balls would stick into and eventually tunnel through them. No changes to restitution, density, velocityThreshold, mass, v_init, etc. would fix the problem. I'm not sure if counter- vs. clockwise will matter in all cases (it shouldn't in your case, since the walls are static) but you should probably be consistent and see if the problem goes away.

By the way, I am using Box2DWeb, a Box2DFlash port.

Top

 Post subject: Re: Zero gravity, Circle shape gets stuck to wallPosted: Tue May 08, 2012 3:31 pm

Joined: Sun Oct 25, 2009 3:28 am
Posts: 242
I don't think Box2DWeb is up to date with the original C++ port. Before 2.2.0, all vertices had to be specified in a clockwise fashion (in the right-handed coordinate system), regardless if they're static or not.

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 6 posts ]

 All times are UTC - 8 hours [ DST ]

#### Who is online

Users browsing this forum: No registered users and 1 guest

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

 Search for: