Sign in to follow this  

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

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 this post

Link to post
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]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this