# Pathfinding between collision objects

**URL:** <https://forum.defold.com/t/pathfinding-between-collision-objects/66242>\
**Category:** The Defoldmine\
**Created:** [September 7, 2020, 1:24pm UTC](https://forum.defold.com/t/pathfinding-between-collision-objects/66242 "2020-09-07T13:24:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon64925349](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/a/e8c25b/32.png) [@anon64925349](https://forum.defold.com/u/anon64925349)\
**Post date:** [September 7, 2020, 1:24pm UTC](https://forum.defold.com/t/pathfinding-between-collision-objects/66242/1 "2020-09-07T13:24:09Z")

</div>

Hello,

I spent a lot of hours creating a program to find the path between collision objects using ray casting. Here I created a method using mainly mathematical calculations and ray casting to measure the distance to collision in the 360 ​​° spectrum. Here is my code for free use and to facilitate the development of your games. I would be very grateful if you post here any modifications to my code, even if it is just a small bug, or a change in some mechanisms for the better or a making code more minimalistic. The program works very fast, about 20 milliseconds on my computer, finding a path between about 4 collision objects. The program lists the individual points of the most effective path in the console, I have not yet worked on the visualization. I wish you good luck in using and editing.

[Path finding.zip](https://defold-forum-bucket.nbg1.your-objectstorage.com/original/3X/9/3/93cbe892d913b73d9e035d83d92a704604637d48.zip) (25.3 KB)

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [September 7, 2020, 1:50pm UTC](https://forum.defold.com/t/pathfinding-between-collision-objects/66242/2 "2020-09-07T13:50:45Z")

</div>

Thank you for sharing the code! May I suggest that you share it on GitHub or similar service? This makes it easier for people to evaluate the code and also make contributions.

---

<div class="post-metadata">

**Author:** ![anon64925349](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/a/e8c25b/32.png) [@anon64925349](https://forum.defold.com/u/anon64925349)\
**Post date:** [September 7, 2020, 1:57pm UTC](https://forum.defold.com/t/pathfinding-between-collision-objects/66242/3 "2020-09-07T13:57:26Z")

</div>

I admit that I don’t have GitHub yet, but I’ll set it up, thank you for the type.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [September 7, 2020, 8:14pm UTC](https://forum.defold.com/t/pathfinding-between-collision-objects/66242/5 "2020-09-07T20:14:22Z")

</div>

Excellent! I noticed that you put the build folder under version control:

[https://github.com/KarelKovarski/Path-finding/tree/master/Path%20finding/build/default](https://github.com/KarelKovarski/Path-finding/tree/master/Path%20finding/build/default)

You can remove the build folder and add it to a [.gitignore file](https://docs.github.com/en/github/using-git/ignoring-files).

And I added an issue I found with one of the function names.
