I wish the Corona docs mentioned that 0 is a special value for density, but I don’t know the exact behavior well enough to suggest a change. Giving the sensor a density of 0.001 instead remedied that particular problem. For example, joining a zero-density sensor ( possibly relevant thread) to my existing dynamic body caused an enormous energy loss. On a peripheral note, other interesting features in the engine may contribute to any individual case of significant energy loss. It doesn’t help you much, other than to provide the confidence that, yes, you really do have to hack in ad hoc corrections to try to simulate perfectly elastic collisions, even though it seems like that ought to be the first case a physics engine gets exactly right. The most detailed analysis I could find of what’s going on in Box2D is here. It would be nice to confirm that tMKS(“velocityThreshold”) really does have some meaningful effect on the engine. ![]() I’m slightly puzzled about whether b2_velocityThreshold is actually a variable that can be changed at runtime as opposed to a header file constant that would require a complete recompile of Box2D. However, Corona eventually provided access to the relevant Box2D config variable (b2_velocityThreshold) via tMKS(), and no one (including me) found that that helped the situation. There was a time when some hoped/believed that the problem was Box2D’s treatment/rounding of slow collision calculations (same battle cry in Unity and Gideros, too!). It merits an appearance in the Box2D FAQ. The issue is most likely in the engine (Box2D) that Corona uses. Scanning the Corona forums, mostly people answering questions on this subject didn’t seem to quite grasp the point: we want the physics engine to accurately simulate physics rather than have to manually hack in ad hoc corrections that have little hope of being precisely physically accurate. At the first part of this tutorial, we just want to run our code in Gideos Player and print Hello Ball to the console. What happens is that the programmer does the appropriate configuration (set all bounces to 1.0, gravity to zero, no damping, etc.) and then discovers that despite all this the system loses energy and slows over time. The classic example is idealized molecular simulation, where gravity is treated as zero and total energy should be conserved. This is mainly a note to my future self or someone else stumbling down the same path (or if someone has brilliant insights/corrections, hopefully they will get tacked onto this thread where I can find them when I forget).Ī minority of cases (like mine) call for physics with perfectly elastic collisions. perfectly elastic collisions require hacking collision events to restore energy on the fly.the problem is most likely in the nature of the underlying Box2D engine and unlikely to change.you can’t get the elastic collisions you would expect in Corona from natural settings.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |