Hi
How to make two or more circle to collide inside the view or frame and bounce back?
Like colorballz apps.
Thanks
Mubarak







float combinedRadius = ball1.radius + ball2.radius
// Get the distance between the balls and check if there is a collision; note this is a short cut insofar
// that we are removing a square root calculation which is very expensive and are checking with the
// distances squared.
float dX, dY;
dX = ball1.x - ball2.x;
dY = ball1.y - ball2.y;
if (combinedRadius * combinedRadius > dX * dX + dY * dY)
<COLLISION OCCURRED>

Return to Android 2D/3D Graphics - OpenGL Problems
Users browsing this forum: No registered users and 2 guests