# I'm embarrassed to say i need help with 3d line/plane intersection

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

## Recommended Posts

Hello all, yes I did just take a calculus course where I learned how to do this just ONE semester ago, but I'm embarrassed to say that I have forgotten how to find where a line intersects a plane.

So here's the deal, I am trying to find out where on the ground of my game (z = 0, its a flat ground) I am clicking. I am using gluUnproject and have found two coordinatees (wx, wy, wz) and (wx2,wy2,wz2). I need to find where the lined formed by these two points intersect the plane z=0.

If you could put this in terms of code I'd very much appreciate it, I can't deal with parametric equations right now :(

##### Share on other sites
For that special plane Z = 0 it's very easy. Just calculate w + (w2 - w) * (0 - w.z) / (w2.z - w.z).

##### Share on other sites
so you mean for each one

x(on zplane) = wx + (wx2 - wx) * (0 - w.z) / (wz2 - wz)

y(on zplane = wy + (wy2 - wy) * (0 - wz) / (wz2 - wz)

z of course = 0

Is that what you mean?

Ah ok, so i got it working just fine. Thanks a lot for the help! :D

[Edited by - FooLeo on September 30, 2010 11:09:06 PM]

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
16
5. 5

• 14
• 29
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631773
• Total Posts
3002265
×