Mass Ball-to-Ball Collision Handling (as in, lots of balls)

久未见 提交于 2019-12-01 20:30:49

Your "resulting code" looks correct. Do you have a simple test case that shows the overcorrection (e.g. x1=0, x1=3, y1=y2=0, r1=r2=2)?

Also, do you get good results if you neglect the overlap and keep everything else, as if the balls were soft rubber?

EDIT:

This part is wrong:

PVector velocity = new PVector(vx,vy);  
...
collider.vy += (bcf - bci) * collision.y;

When two balls get close they damp each other's velocity until they both stop. But on the bright side, you've invented solids (just kidding). Turn off the overlap stuff and don't worry about it until you have this part working.

Getting this part working will be just about impossible without an understanding of basic physics. Do you need a hand?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!