Do you know why when I create a body with allowSleep=false or if I create the b2.World with doSleep=false when a body hist the ground I receive endless pre solve and post solve callbacks?
Since there is no "AwakeBody"(e.g. setAwake) API in Gideros I really need the sleep = false all the time for what I am trying to do.
Should I not ever use sleep = false if I want to use collision callbacks?
BTW: I was printing something on the console on each callback and in about 30 sec it would fill the buffer or something and the entire Gideros environment freezes until I kill the player app.
Any suggestions?
Thanks
Comments
Is there a reason you are using pre and post solve callbacks instead of begin collision and end collision?
pre and post solve will be called all the time there is no collision, I believe, so not a good place to put a print.
Maybe increment a count on pre and/or post and print the count on collision begin to see what's happening/how long before collision?
Just an idea
Cheers
evs
@ar2rsawseen - the end collision does not always come for me if the body is not "bouncy" and hits the ground or ends up laying on another body. I will try to use just "begin" if the event provides me with all the info I need.
I have to do some research based on the info you gave me in another dicussion...
@evs - I use the print for debug. I will change it to count or something as you suggest. The point is that if sleep is enabled there is no issue.
I think this is not Gideros, but box2d thing. I will try to change the design a little to overcome the issue.
Cheers
Vlad
If for example he removes a body sitting under a sleeping body. The sleeping body will not wake up and the gravity will not affect it because of the sleep optimization in box2d.
Since the box2d way to just wake up body is not exposed in Gideros I can't wake it up programically (well I actually could by giving it an insignificant velocity which I don't like).
And this is just an example.
Just saying it would be nice to have setAwake or something in Gideros one day...
btw, I haven't tested but shouldn't box2d wake up a sleeping body when a nearby _touching_ body is removed?
It is better to you mouse joint for that purpose, which I think should wake up surrounding bodies on collisions
http://appcodingeasy.com/Gideros-Mobile/Dragging-Box2d-object-in-Gideros-Mobile
Of course I might be mistaken.
@ar2rsawseen, I havn't thought about using mouse joint. I will research. Thanks for the idea and the info!
Thanks again Atilim! Great support!