Basic enemy AI doesn’t avoid obstacles

With the enemy js script credit albertos. The enemy will go through stuff how would I fix this?

Hi @Mason_Rocchio! Please make sure you use a collision component (with the correct size) and a rigidbody component on your obstacles.

@albertos he said avoid obstacles not collide, i think he wants the AI to avoid objects instead of running into them.

To make that work, every obstacle need a collision component and a rigidbody component. Otherwise the enemy can’t detect the obstacle.

true, i’m having the avoid problem as well for my rpg game, but that’s not important at the moment.

If you use the same script, please check the setup of the original project.