Jump to content
  • Advertisement
Sign in to follow this  
FooLeo

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.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!