Finding closest object to a location within a specific perpendicular distance to direction vector

Posted by Sniper on Game Development See other posts from Game Development or by Sniper
Published on 2012-07-07T20:23:02Z Indexed on 2012/07/08 9:23 UTC
Read the original article Hit count: 261

Filed under:
|
|
|

I have a location and a direction vector indicating facing, I want to find the closest object to that location that is within some tolerance distance (perpendicular distance) to the ray formed by the location and direction vector. Basically I want to get the object that is being aimed at.

enter image description here

I have thought about finding all objects within a box and then finding the closest object to my vector from them results, but I am sure that there is a more efficient way.

The Z axis is optional, the objects are most likely within a few meters of the search vector.

© Game Development or respective owner

Related posts about c#

Related posts about 3d