Hi,
I am currently coding a swing game in which i have an escalator to swing across.I created the escalator effect by moving a slab by increasing its .y property in runtime event listener. now when i try to cross if i accidentally hit on the escalator instead of hitting and bouncing back, the character sticks to the escalator and goes down. I have the slab declared as a kinematic bodytype . I even tried to reduce the friction to 0. Nothing helped.
Please help!!
Thanks in advance. [import]uid: 76873 topic_id: 16554 reply_id: 316554[/import]
There´s a blog post about sticky physics, look for that. [import]uid: 13560 topic_id: 16554 reply_id: 61814[/import]
I tried changing the bounce and friction properties. Even the physics.setPositionIterations() and physics.setVelocityIterations().
Nothing helped. [import]uid: 76873 topic_id: 16554 reply_id: 61817[/import]
I believe lano is talking about either this post:
http://blog.anscamobile.com/2011/08/solutions-to-common-physics-challenges/
or this one:
http://www.ludicroussoftware.com/blog/2011/09/01/corona-physics-forced-bouncing/
but regardless, if you read the comments in the first ansca post, the very first comment nails the problem on the head:
"Nice tutorial.
I have however a point about “sticking to walls” / also other objects.
That is due to the elastic collisions velocity threshold from Box2D, which is not exposed to the Corona API, and all the tricks above will not work since increasing bounce, decreasing friction has as result objects moving at very high speeds, higher than the normal “simulation”.
https://developer.anscamobile.com/forum/2010/11/10/expose-box2d-velocitythreshold-parameter-help-sticking-objects is the thread where i’ve been asking for quite some while now about exposing at least this flag to the API.
So if you really wanna help solve those physics problems, expose the flags from the Box2D config which affect the world and the collisions to the Corona API. Then, and only then, all the things you mentioned above will work correctly."
So far the only real solutions seem to be workarounds. [import]uid: 49447 topic_id: 16554 reply_id: 61830[/import]
Thanks you for your reply producerism.
I tried all the 3 solutions in the first blog and also tried the code in the second. And i cant believe that still it dint work 
Actually the physics works fine for all the rest of the objects(nearby).All objects are exactly similar. The only difference is the others are static whereas the one that is sticking is kinematic one which is moving in positive y axis(updated in runtime like ball.y=ball.y+1).
If I make the object static and fix it in a position the physics works perfect. The sticky thing happens only if i make the object move.
Please help me as this really spoils the game i am working on for months!
Thank you.
[import]uid: 76873 topic_id: 16554 reply_id: 61837[/import]
Finally i have solved the problem by stopping the escalators motion at the began event of collision and resuming it at the ended phase.!Every problem has a definite solution . just have to work a bit …!thank you everybody …!
wwoohaaa…!!
[import]uid: 76873 topic_id: 16554 reply_id: 61844[/import]
how did you resolve this? cuz i have the same problem with a bouncing ball and a moving paddle.
thks, [import]uid: 91584 topic_id: 16554 reply_id: 72671[/import]
Build 700 gave us:
physics.setMKS( key, value)
physics.getMKS( key )
which exposes the velocityThreshold as well as some other properties. (No access to time step though.)
Scroll down to the bottom of this thread:
Haven’t had a chance to test it yet, though I did check to see that the default velocityThreshold is 1. Setting it lower would probably solve the sticky walls problem. [import]uid: 40137 topic_id: 16554 reply_id: 72684[/import]
Also, @producerism (sorry for hijacking this thread anand.cegc) but I was going through the Box2D docs again and noticed they recommend an iteration count of 8 for velocity and 3 for position. Corona has the defaults flip flopped (8 for position and 3 for velocity). I flipped them around and there was definitely some kind of difference on the simulator, but I haven’t had a chance to do any testing on a device yet. Have you messed around with these settings at all and if so do they have any (positive) affect on the frame rate based physics problem? [import]uid: 40137 topic_id: 16554 reply_id: 72685[/import]
Yes, I have played around with those values a bit. For me, there was no substantial difference in performance, although I did notice how it affected collisions.
I’ve got my currently set at
[lua]physics.setPositionIterations( 4 ) – performance tweak (default = 8)
physics.setVelocityIterations( 1 ) – performance tweak (default = 3)[/lua]
If interested, here’s a quick screen capture from the simulator. This is about how fast it runs on Android:
http://www.youtube.com/watch?v=ivmquXYZV3U [import]uid: 49447 topic_id: 16554 reply_id: 72690[/import]
You probably have seen this thread on the new physics parameter options that should help sticky objects.
-David [import]uid: 96411 topic_id: 16554 reply_id: 72698[/import]
@producerism, that’s what I figured.
PS, digging the top down shooter. [import]uid: 40137 topic_id: 16554 reply_id: 72701[/import]