[Unity makes wheels] Realization of 2d enemy AI, and automatically avoids obstacles

Final effect
insert image description here
plug-in link:
https://download.csdn.net/download/qq_36303853/87762376
import AI plug-in
insert image description here

Create a new empty object, add the PathFinder component, and use
insert image description here
it to render the navigation path in map navigation. The blue part drawn is the walkable area, and the non-blue area is the collider area I configured. You can modify it yourself. If you are not satisfied, you can modify Diameter value, to control how large the collider area is and cannot walk
insert image description here
. Add a collider to the enemy, and the collision area will adjust itself
insert image description here
. Add an AIPath component to the enemy, our 2d project here,记得orientation先选择YAxisForward(for 2D games)

Guess you like

Origin blog.csdn.net/qq_36303853/article/details/130549157