ray plane intersection

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

Recommended Posts

i have a plane at 0, 0, 0 and a ray at origin -20, 10, -10 and the direction of the ray is 30deg right, 20deg down how do i calculate where it intersects the plane ?

Share on other sites
The ray equation is
R(t) = O + tD

where O is the ray starting point, D is the (normalized) ray direction vector, and t is a parameter that gives you a point ( R(t) ) on the ray

The plane equation is
ax + by + cz + d = 0

wich can be rewritten as
N.P + d = 0

where N is the plane normal, P is a point on the plane and d is the distance of the plane from the origin. ( . means dot product )

So to find the intersection between the two you have to get the ray and plane equations. The ray origin is ( -20, 10, -10 ), you must find the direction vector and normalize it (what do you mean by 30 degrees right, 20 degrees down?)

Then you find the plane equation. Again, what do you mean? That the plane normal is ( 0, 0, 0 )? You need the distance from the origin too.

Then you compute the intersection. You have to replace the 'P' in the plane equation with the ray equation. So it becomes
N.( O + tD ) + d = 0N.O + t( N.D ) + d = 0t = -( N.O + d ) / ( N.D )

The final equation is the one you need. Compute the value of the parameter t, then substitute it in the ray equation to get the actual point:
Point = O + tD

Share on other sites

would you be able to give some example values in the equations please, would help alot

:)

Share on other sites
distance = ( plane_normal dot ( plane_origin - ray_origin ) ) / ( plane_normal dot ray_direction )

location = ray_origin + ( ray_direction * distance )

• What is your GameDev Story?

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

• 9
• 34
• 16
• 11
• 10
• Forum Statistics

• Total Topics
634122
• Total Posts
3015643
×