0 votes

I'm having trouble wrapping my head around how to have a unit, let's say a large unit that takes up 2x2 on the map, path properly using AStar.

I've had a hard time finding any tutorials explaining how to approach this situation. And I didn't see anything for this in the documentation.

The objective is for AStar to path properly around obstructions (walls, pits, hostiles).

What's the best way to handle entities that are larger than 1 cell?

Godot version 3.4.2
in Engine by (35 points)

1 Answer

+2 votes

One approach would be to create another Astar for every unit of different size and design its points distribution in different density, proportional to size of unit. It will require to check all tiles within range of each point and determine if its disabled/enabled, depending on presence of obstacles.

by (5,132 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.