Expose Box2D velocityThreshold parameter to help with sticking objects

velocityThreshold is discussed here…
http://box2d.org/forum/viewtopic.php?f=3&t=1238&view=next

Instead of increasing the sleep tolerances, another alternative is to increase the minimum velocity threshold for elastic collisions: b2Settings::b2_velocityThreshold
Collisions with a relative velocity under this threshold will not bounce.

in fact more overall control of Box2D parameters for those of us that want more advanced control please

although note the comments below


IIRC Box2d has logic built in that dampens even fully elastic collisions at very low velocities - you can alter the value if you want, it’s in org.jbox2d.common.Settings, the field velocityThreshold. Actually, looking at that now, it’s set at 1 m/s, which I think is probably rather high for a pool game. Ramping it down might help, especially since you don’t need stacking of those objects.


Look in b2Settings - one of the parameters there (b2Settings::b2_velocityThreshold) determines when bounces are ignored. Set it to zero for billiards.


My balls and table were scaled to meters, so the balls themselves were quite small. After scaling everything up by 10, so the balls have a radius of .2 instead of .02, things work much better.
[import]uid: 6645 topic_id: 3536 reply_id: 303536[/import]

I am having problems with sticky walls, this would definitely help me solve my problem.
http://developer.anscamobile.com/forum/2011/02/11/sticky-walls [import]uid: 11334 topic_id: 3536 reply_id: 22628[/import]

+1 to sticky walls. all previous suggestions for sticky walls did not work.

The only way I could begin to get around sticky walls is to avoid creating my objects near the walls.

I have not simulated sticky walls other than objects floating upwards. [import]uid: 32936 topic_id: 3536 reply_id: 23129[/import]

+1 for me too, I’m trying to make a Pool-like game and the ball keeps on sticking to the walls, no matter what i do.

Having access to Bos2D settings, and specially velocity threshold would really solve the problem.

thanks [import]uid: 36639 topic_id: 3536 reply_id: 23519[/import]

Count me in for this. I’ve been developing a pool game and this is a major problem with slow moving balls. Has this been noticed by anyone at Ansca? [import]uid: 13522 topic_id: 3536 reply_id: 26619[/import]

+1. Developing a physics-based game that follows a pool-like scenario. The sticky walls problem happens all the time, and it’s keeping me from release…

Thanks. [import]uid: 4572 topic_id: 3536 reply_id: 27786[/import]

Pool? as in Pool table?

Did you see our sample code? There is a pool table sample code.

C. [import]uid: 24 topic_id: 3536 reply_id: 27794[/import]

From the bundled Box2D headers in the current Corona distribution:

#define b2_velocityThreshold 1.0f

So any velocity under 1.0 will be treated as nonelastic in a collision.

Problem is by pool bumpers they have to bounce back at any velocity that is greater than 0.

As the velocity is not exposed as a property of the physics object, that affects any kind of physics scenario involving objects hitting walls at low velocities, including the Sample Pool from the Physics directory in the Corona distribution. The balls simply stick to the walls (nonelastic) instead of bouncing.

Will post that as a bug too, thank you Carlos for the quick reaction.

Alex [import]uid: 4572 topic_id: 3536 reply_id: 27804[/import]

Hi Carlos,

Yes, I saw the example (in fact It gave me great ideas to develop my project), but the problem exists in it, too. When the ball is moving really slow and it hits a wall, it sticks to it and moves along the wall. I would like my game not to do it, and when coding in Box2D I could have access to some settings (like Velocity Threshold) that avoid this problem.

I’ve been thinking to export my Corona code into Xcode (instead of building it for devices) and try to change those settings.

I will tell you if I’m lucky with that.

Thanks!
Hector [import]uid: 36639 topic_id: 3536 reply_id: 27805[/import]

No luck, I didn’t know that you can’t touch code after building your project… [import]uid: 36639 topic_id: 3536 reply_id: 27808[/import]

Has anyone had any luck with this? Its really the only thing stopping my app from release now. [import]uid: 13522 topic_id: 3536 reply_id: 29576[/import]

so we have physics.setVelocityIterations… can one of you file a bug report, send me the ticket number and I will escalate it.

c. [import]uid: 24 topic_id: 3536 reply_id: 29615[/import]

Bug filed is 4148…

The thing is, Carlos, we really have to be able to modify the b2_velocityThreshold. Or at least have a simple setting to set the threshold to 0 in the simplest case…

Thanks for the attention.

Alex [import]uid: 4572 topic_id: 3536 reply_id: 29633[/import]

raised
[import]uid: 24 topic_id: 3536 reply_id: 29638[/import]

Thanks, Carlos. [import]uid: 4572 topic_id: 3536 reply_id: 29702[/import]

Hello Carlos,

Could we get at least an estimate how long it will take until we have some kind of a solution for this?

I know you guys have a *LOT* to do. But the bug i filed is still unchanged as status, and i really need to know if there is gonna be a solution soon.

Thank you in advance.
Alex. [import]uid: 4572 topic_id: 3536 reply_id: 30649[/import]

+1 to exposing Box2D parameters in general. I can see this as being really handy. Maybe we could pass our desired settings in through the physics.start(…) function or something. [import]uid: 23229 topic_id: 3536 reply_id: 32526[/import]

+1 I have this problem too, for a ball fired along a curve. [import]uid: 36578 topic_id: 3536 reply_id: 37418[/import]

+1 I have this issue. Any updates? [import]uid: 57055 topic_id: 3536 reply_id: 42308[/import]

Duplicate thread, but i think it’s time that this gets a resolution. Otherwise it makes no sense for me to keep sticking to Corona.
Hello Ansca,

3 months gone again. Last post from Carlos on 6th of May on my other thread (https://developer.anscamobile.com/forum/2011/03/15/box2d-velocitythreshold-problem).

I know you make a lot of developers requests come true. This one seems to be the one that simply won’t come up.

Starting to wonder if you fully understand what the concept “Cannot launch my game due to one bug that makes objects stick to the walls at lower velocities” means.

It means that i created two games based on physics, and both stay in the dust, since it makes no sense to release them with such a bug. It breaks up the game’s logic.

Look at the start date on this thread and the other one that’s linked. Look at the time i filed the bug 4148. Look at how many times i got the promise on both threads this will get solved.

No more comments from me. Just plain dissapointment.
Alex. [import]uid: 4572 topic_id: 3536 reply_id: 48967[/import]