Raycast 2D question

Godot Version



Hello, I’m currently using a timer on the enemies in my game to cast a ray towards the player.

The reason I’m using the timer is cause i figure it would be more performant than casting a ray every physics frame.

My question is if there’s even any difference between doing it that way and just casting the ray in _physics_process.

The godot documentation says that raycast 2d updates every physics frame anyway and I’ve been having problems with the enemies finding the player using the timer.

Any help would be much appreciated, thanks!

The difference is negligible unless you have 1000+ enemies at the same time.


I’d say I have around 30-40 enemies max at any given time.