Hey guys,
I'm trying to trigger enemy events at certain distances, for instance shooting at the player when he comes within range.
What's the cheapest way to handle this? vector3.Distance seems to munch CPU like there is no tomorrow when you have quite a few objects trying to calculate at the same time. All that square rooting I guess.
For the time being I've resorted to a HUGE (some 150 game units!) sphere collider set as a trigger around the player. Doing a similar thing in reverse for enemies caused big performance issues as well.
I'm sure there must be a nicer and more cost efficient way of handling this, I suspect this is a noob question set to get flamed but I couldn't find any solid reference for it. Is raycasts the way forward?
Thanks in advance!
Thanks muchly :)
– anon73128419