3d Navigation w/ Yuka.js (1st attempt)

Original:

Slightly-cleaned:

This playground demonstrates a first attempt at getting the Yuka.js NavMesh class working on a non-flat 3d terrain. In this example the terrain being used is the surface of a tree-trunk and it’s branches.

You’ll notice in the code, there’s a function called connectNodes (being used at lines 108-128), and it is used to literally patch the navMesh.graph with the missing graph edges necessary to allow navigation from any of the branches back to the main tree-trunk.

Currently the best navigation is achieved by first selecting a point on the surface of the tree trunk near the branch you want to travel to, allow the cone to travel to that position first and then click somewhere on the branch. Otherwise the path generator is prone to generating unrealistic paths.

I realize this is pretty hacky, but you’ve gotta start somewhere! I’m also really hoping that people smarter than me will chime in :smiley:

I wanted to note that I borrowed a bunch of code from @labris/@roland 's examples, it was extremely helpful.

8 Likes

Nice !!!

1 Like

That’s super cool! :smiley:

1 Like

Hi!
Unfortunatelly the PG didn’t load for me :frowning:

1 Like

Oh weird, it was loading for me before :open_mouth: Maybe a server problem?
image

3 Likes

@roland @carolhmj that’s my bad :confused: Ive been switching the urls around for different buckets. I really need to start hosting everything for useful playgrounds over to a github.io endpoint.

This pg should work:

Please let me know if it doesn’t

3 Likes

Hi! Well done @arcman7!

I like the idea a lot!

Yes, this is the case, sometimes the ship/vehicle just starts to twerk :smiley: But if I select the end of the branch it navigates quite smoothly. I am looking forward for the next version!

:vulcan_salute:

r.

3 Likes

Live long & prosper! :vulcan_salute:

2 Likes