Trouble Finding Closest Points from Division Points


I am trying to implement a hand gesture controlled labyrinth (the one where you try and get a marble from point A to B).

I’ve used a maze generator I found here, and now I’m trying to implement the following logic:
The maze is simply a path (795 curves to be exact) which is divided into smaller segments using Curve Division.
For each point the marble lands on, GH finds the 3 nearest points and decided where to move next according to the user’s decision.

So I was wondering (1) whether anyone had a better Idea of implementing this (assuming the user keeps sending a 3D vector representing it’s desired direction), and (2) which is more critical is why my Nearest Points component isn’t working as I expected?
When handing over the Division Points and Current Point as input, it finds a bunch of random points. Definitely not the 3 nearest ones as I wanted it to find.

I’ve search and read all the relevant stuff I could find, including the actual GH API, but couldn’t find the cause for this.

Image description:

  1. The point. (The sphere is just visually connected to it)
  2. The point from before.
  3. The list of division points (they all appear as crosses on the left)
  4. The number of points to find are 3.

Screenshot of the inputted point:

Inputted list of points:

Thank you!

Just looking at the picture:
Flatten input of c.
Have a look at the gh primer to learn about das structure. (Don‘t have the link atm, just google it)

1 Like

Thanks a lot Tim :slight_smile:
Getting familiar with the gh-primer as we speak