• What is your GameDev Story?

Archived

This topic is now archived and is closed to further replies.

sphere collision

This topic is 5450 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

What would be the best way to go about sphere collisions. If you know the velocities of two elastic objects and thier masses, how would you end up with how the balls would react? It would be best if I coudl apply this to vector velocities on each axis (velocity for the x, velocity for the y, ect.)

Share on other sites
You might get more help from the Math forum. But in any case, I''m not 100% what your asking, but I think you want to know when two moving spheres will collide. I think you can simplify the question my a lot by pretendind that you''re just intersecting a sphere with a line. The imaginary sphere would be in an arbitrary location (I suppose the origin for simplicity) with a radius equal to the sum of the radii of the real spheres, while the line is the net velocity vector of one sphere relative to the other. In other words, assuming you have two spheres, at points P1 and P2 with radii r1 and r2 moving at velocities v1 and v2, just find the intersection of:

x^2 + y^2 + z^2 - (r1 + r2)^2 = 0 (the standard formula of a sphere)
and the system of equations represented by the vector v2-v1.

Zorx (a Puzzle Bobble clone)
Discontinuity (an animation system for POV-Ray)

Share on other sites
An easy way is to check the distance from the center of both spheres, if the radi''s added are greater than the distance they have colided. Then get a vector from one to the other, that is the normal of impact, combining that with their velocity you can have any sort of bounce you want.

• What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 10
• 9
• 35
• 16
• Forum Statistics

• Total Topics
634125
• Total Posts
3015680
×