Author Topic: cone raycast  (Read 1389 times)

i'm trying to do a raycast to detect any hit object inside a cone. does someone know how i can do this without firing a bunch of raycast lines in a cone-type pattern?

may be easier to do the reverse if there arent many things to check: iterate through a list of objects that may be in cone and individually check each

otherwise youd have to do a tiered set of box radius searches like a mayan pyramid

well im very bad at math and i don't fully understand how checking the inside of a cone's area translates to blockland's vectors

its not really a suggestion but im just wondering if someone can give me some sort of psuedocode

well im very bad at math and i don't fully understand how checking the inside of a cone's area translates to blockland's vectors

its not really a suggestion but im just wondering if someone can give me some sort of psuedocode

You could get the vector between the target and the player (or w/e is doing the check) and then compare the angle between that vector and the player's forward vector. If the angle is larger than what you want, then the target is out of the cone.

so essentially a container raycast around the source player, and check each collision to see if it lies within the source player's theta?

I recommend you ask Conan or someone for specifics. I'm not the most proficient in this area of modding.

But I think the container raycast would be fine. I don't think you'd want specifically the player's theta. If you want to simulate a cone search, you'd want to get the angle between the player's theta/forward facing and the vector to the target.

Do a radius search around the player, and compare the angle of the objects within.