ZenkakuHiragana / gmod_addons

My Garry's Mod Creations
https://www.patreon.com/ZenkakuHiragana
6 stars 0 forks source link

(Question) The shortest path to the goal? #6

Closed Shark-vil closed 3 years ago

Shark-vil commented 3 years ago

Is there a function that can create the shortest path to the target, ignoring some restrictions? I am currently using code like this:

Code_Ezw6qLvl4d

I want the car to be able to follow the target along the points as close as possible to it, but the pathfinding method when using this function creates unnecessary long paths. ignoring the opportunity to turn around on the spot (since points nearby have no connection and move in a different direction)

An example of a problem:

mpc-hc64_Q33grpjp9E

Is there a function or code snippet that can do what I need? :)

I apologize for the duplicate question in the Steam discussions

ZenkakuHiragana commented 3 years ago

Basically you can't, but I think it's possible by the following steps: 1. place some helper waypoints with a specific group number. 2. set the third argument of DecentVehicleDestination.GetRoute() to it when the car needs a shortcut.

Shark-vil commented 3 years ago

Basically you can't, but I think it's possible by the following steps: 1. place some helper waypoints with a specific group number. 2. set the third argument of DecentVehicleDestination.GetRoute() to it when the car needs a shortcut.

Okay, I'll check it out. Thanks for the answer.