简体   繁体   中英

Corona sdk physics precise collision between 2 round objects

I am working on the start of a golf game where a ball rolls into a hole. I have it working, but when the ball simply touches the edge of the hole, the collision event makes it drop in (disappear). I want to create more precision so that it will be more realistic. Any advice would be appreciated.

The easiest way to solve this problem is have the real body be an invisible ball smaller than display ball that the user sees. You can also manipulate the pre and post collision event handlers to deal with this.

You also should be wary of the fact that speed matters in Box2d collisions. This kind of mechanic often takes some tweaking in my experience.

http://developer.anscamobile.com/content/game-edition-collision-detection

You could start a transition when you detect the collision with the hole. That transition would take some time to complete, eliminating your "ball immediately disappears" problem, and with a little math, could properly reflect the speed and direction of the ball so that the drop into the hole looks fairly realistic.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM