Jump to content
  • Advertisement

Archived

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

Mr Lane

Planes and Points and Normals

This topic is 5176 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

Forgive me, I am a maths retard, but I have to use some maths for a simple sphere-polygon collision system I need to write. I am currently just trying to test if a sphere hits a plane in space by getting the distance between the plane and the centre of the sphere and checking to see if it is smaller than the radius. The problem is it is not working and i have come to the conclusion it must be in my calculation of the distance between the plane and the *centre* of the sphere. My plane is defined by a normal N to the plane and a point on the plane P...Is it correct that the distance from some point *not* on the plane B, to the plane is: distance = Nx*Bx + Ny*By + Nz*Bz + D where: D = -(Nx*Px + Ny*Py + Nz*Pz) ?? Thanks. I will have more maths questions over the next week.

Share this post


Link to post
Share on other sites
Advertisement
To get the distance between a poly (say three points v1, v2, v3)and sphere (I assume we mean centre point p) just use :

distance = normal.DotProduct(pt-v1);

then
if( distance < radius)
collision occured

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!