Jump to content
  • Advertisement


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

dan parker

Bounding Spheres

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, can anyone tell me a formula to work out the reflection vector of bounding spheres? i have an array of spheres moving within a cube, i''d like to be able to make them bounce off each other at the correct angle. each sphere has a vector to store its direction, and a float to store its velocity. many thanks Dan

Share this post

Link to post
Share on other sites
The direction is a vector between the centres of the spheres.

To find the actual point of collision you can simply scale that vector by the radius of one sphere and add it to the sphere''s position vector (just be careful which sphere you use as the direction''s initial point and which as the terminal point).

Share this post

Link to post
Share on other sites
actually, the equation is very simple for a perfectly elastic collision (like 2 really really really super boncey balls smacking into each other, rather than an inelastic collision like 2 cars, 2 football players, 2 wads of grape jelly, etc...)

anyway, each sphere will have a velocity x,y,z

(as long as both spheres are of equal mass)
sphere1 = x1,y1,z1
sphere2 = x2,y2,z2

after collision:
sphere1 = x2,y2,z2
sphere2 = x1,y1,z1

that looks silly, but they really do just take each others velocity. i have to run back to work, but if you want a less elastic collision (perfectly elastic collisions don''t occur in the real world) or formulas for 2 objects of different mass post again, i am sure anyone with a college pissics book on their shelf can look up the formulas for you.

Brett Lynnes

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!