Check if a display object is part of a physics system? I have some code where I am checking the velocity of objects, but obviously getLinearVelocity() will throw errors if the object body hasn’t been added to the physics yet.
Check if a body is sleeping? I know about body.isSleepingAllowed(), but shouldn’t there also be something like body.isSleeping()? I’d like to remove objects if they come to rest. What is the best way to do that? [import]uid: 52127 topic_id: 9855 reply_id: 309855[/import]
isBodyActive always returns true though, unless you set it to false yourself. If I throw a ball for example, I want to remove it if it comes to a stop (or close to a stop for all intents and purposes). I guess the only way to do that is to continuously check the x and y velocities of every ball on the screen and remove the ball if those values are both below a certain threshold. [import]uid: 52127 topic_id: 9855 reply_id: 35980[/import]
That might be the easiest way and wouldn’t be too bad depending on how many objects there are at any one time. [import]uid: 5833 topic_id: 9855 reply_id: 35982[/import]
Why doesn’t Corona provide an event that fires when a body just slept and/or with a supplied velocity threshold that falls within range? [import]uid: 166680 topic_id: 9855 reply_id: 120769[/import]
Why doesn’t Corona provide an event that fires when a body just slept and/or with a supplied velocity threshold that falls within range? [import]uid: 166680 topic_id: 9855 reply_id: 120769[/import]