How Should I Do Pathfinding in Custom Geometry?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By MScribner
:warning: Old Version Published before Godot 3 was released.

I need to add pathfinding AI to my game, which does not have a tilemap for collision. My initial idea was to create waypoint nodes to traverse, and to generate a wide tilemap that has the id of the closest node. Then, if you are not directly in the line of sight of your target, you go to the nearest line of sight node(found by whatever tile you’re on), and then traverse the waypoints until you are in line of sight of your target.

However, generating a tilemap for an arbitrary image is sort of difficult I’ve found. I can’t just get the size of the image and generate it from that? Any alternatives or ways I can generate a tilemap from an arbitrary image’s dimensions and a preset tile width?

What’s your problem actually? Can’t you do a double for loop in X and Y and place things on the tilemap from what you get in the image?

Zylann | 2017-10-15 15:49

I can’t find the width and height of the image, so I can’t create bounds for the loops.

MScribner | 2017-10-15 20:58