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]
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…
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]
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.
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]
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]
+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]
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]