# point to 3D plane collision detection

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

## Recommended Posts

I am wondering if there is a way, I can take a triangular plane in 3D and drop a ball down into it, how do I find if the ball entered the triangular plane in 3D, and if it did, it's Y position. I know a lot of math, so feel free to throw some trig and vector math my way.

##### Share on other sites
I take the position vector of the ball relative to the plane. (subtract the ball coords from an arbitrary reference point on the plane that contains the triangle)

Dot product this position vector with the Normal of the plane to see what side of it the ball is on. (if the dotproduct is negative the ball is below plane and might have impacted) next need to see if the ball's path actually hit the triangle.

taking the vector between the ball's previous and current location, intersect with the plane to see where it exactly hit.
Next need to see if this possible collision point lies within the borders of the triangle.

I simply do a similar dotproduct test of this position against 3 perpendicular planes that represent the sides of the triangle...

If all pass, ball has impacted.

##### Share on other sites
Quote:
 Original post by DroxXodiaI am wondering if there is a way, I can take a triangular plane in 3D and drop a ball down into it, how do I find if the ball entered the triangular plane in 3D, and if it did, it's Y position.I know a lot of math, so feel free to throw some trig and vector math my way.
It should probably be mentioned that there isn't really such a thing as a 'triangular plane' (AFAIK at least).

If your intent is to determine if and where a moving sphere intersects a triangle, something similar to what haphazardlynamed suggested should work. However, it's not a complete solution, as it does not consider intersections with the edges and vertices of the triangle.

If you need further help, you might clarify whether the object in question is a plane or a triangle, and (if it's a triangle) whether you need correct behavior when the ball hits an edge.

##### Share on other sites
Quote:
 Original post by jyk[However, it's not a complete solution, as it does not consider intersections with the edges and vertices of the triangle.

It doesnt?
OH
Right, it's a Ball, not a Point...
The ball's Radius causes issues near the edges of the triangle.

For a semi-fix, you could modify all the dotproduct checks into distance checks, then offset by the ball radius.
However this still has problems at the Corners of the triangle...

I don't have the exact math for that one at the moment, typically I use this kind of collision on a closed mesh where falling off the edge of one triangle, just means you hit his neighbor instead....

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 14
• 13
• 9
• 12
• 9
• ### Forum Statistics

• Total Topics
631437
• Total Posts
3000063
×