2
\$\begingroup\$

How the it looks before I play

So far Ive implemented a 2D grid graph using 2D physics. My enemies have a seeker script, AI destination setter (with the player position attached) and a basic AIPath script that is set to 2D

When I press play, my enemy game objects move away from the marked area where they can't go, and the area remains static. Is there a way to make this marked area follow the colliders using A*?

This is the script Im using: https://arongranberg.com/astar/documentation/4_1_16_7f164ebc/aipath.html

I don't have the pro version of the above asset though, so can't make use the built in function that handles situation like this.

\$\endgroup\$
3
  • \$\begingroup\$ You may want to explain how you've configured your pathfinding for these characters so far. There's more than one pathfinding library available for Unity, so knowing how you've set up your project can help users suggest solutions that will fit with your approach (or suggest better alternative approaches). \$\endgroup\$
    – DMGregory
    Jul 6, 2020 at 13:27
  • \$\begingroup\$ Is this the AI Path script you're using? Again, because there are many implementations of this behaviour, we need you to be specific. If this is the library you're using, it looks like it already contains support for local avoidance, which should give you the behaviour you want without modifying the underlying obstacle mask. \$\endgroup\$
    – DMGregory
    Jul 6, 2020 at 14:04
  • 2
    \$\begingroup\$ For what you're trying to do, enemies that seek out the player while keeping separated, marking the enemies as A* colliders sounds like the hard approach. I would simply have them collide with each other while following the path to the player, or maybe AI behaviors like 'avoidance'. Try googling 'boids separation' although that's probably more complex than you need gamedevelopment.tutsplus.com/tutorials/… \$\endgroup\$
    – jhocking
    Jul 6, 2020 at 14:42

0

You must log in to answer this question.

Browse other questions tagged .