Alternative to ray-cast, due to lag?

image
Ray cast is a huge problem. Causing most of the lag. I don’t know if there’s another option. Since it’s a tower defense and everything uses ray-cast to check for targets.

3 Likes

try using coordinate detection to detect if they are at a certain position

1 Like

I looked in your code and failed to find anything that has raycasts in it. Could you please find what is sending them? Then optimization could be much easier to problem solve.

image
image
I made a semi-fix, to where now it checks if there is an enemy alive able to be hit, but that doesn’t change much.
image
And the eater is constantly detecting for plants to eat.

1 Like