Well, the title is very self explanatory.
Thanks in advance!
Turret doesn't shoot by itself, it triggers an event "On Turret shoot". Inside this event you can check that the turret is not overlapping an enemy, and only then create a bullet.
Develop games in your browser. Powerful, performant & highly capable.
I think you didn't understand what I want, I want the turret to aim for a target only if there is no solid objects between them.
Your title says nothing about solid objects. "Collision" is when two objects touch!
You should use Line of Sight behavior. And instead of adding object to turret's targets, acquire and unacquire targets.
Here is a similar demo, you can add a solid wall to it and turrets won't shoot at targets that are behind the wall:
howtoconstructdemos.com/how-to-limit-the-angle-of-view-for-turret-behavior
Sorry, I meant collision as like, solid objects.
I thought of using the line of sight behavior, but as it may get overcomplicated, I posted it to see if anyone has come up with a better way to do it.
Thanks!