Jump to content
  • Advertisement
Sign in to follow this  
BroderickCalpe

Intercepting a line

This topic is 2028 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

I have drawn a line from 0, 0, 0  to 0, 1, 0. So in other words it drawn going upward.

 

How can I check of some object intercept my line ?

 

Any detailed description or tutorial?

 

 

Share this post


Link to post
Share on other sites
Advertisement

Use google?

 

What kind of intersection you want to check for?

Some specific like line-plane (line-triangle?)?

 

Or do you want to know how to properly check for intersection with a big model with many triangles?

 

Or perhaps you want something like raycasting?

Edited by Waterlimon

Share this post


Link to post
Share on other sites

Here is how I would do it:

 

the distance from one point to another is sqrt( (X2 - X1)^2 + (Y2 - Y1)^2 + (Z2 - Z1)^2 )

 

The equation for your line is  0xi + 1yj + 0zk => yj

 

So you would want to see if that line ever comes closer to the center of the sphere than the radius of the sphere.  So basically, is there any value of y (for your line) that would make the distance calculation above be less than or equal to R.

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!