- Home /
Question by
slobodaapl · Dec 04, 2021 at 01:23 AM ·
collisionraycastspeedperformance optimizationfindgameobjectswithtag
In terms of performance, which one is faster, 2D raycast, collission or distance sorting?
I'm met with a 2D situation where I need to be able to detect when objects come into a vision cone (think enemy vision cone in stealth games).
Would this best be done with a cone-like object with collision, a 2D raycast or FindWithTag then converting to polar coordinates of the object's local space and checking whether the angle and distance fit for each object with the correct tag?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613050155im_/https://answers.unity.com/themes/thub/images/avi.jpg)