As I work on developing a point-and-click test game, I've made significant progress by conducting thorough research and finding answers to various inquiries on Stack Overflow. However, I have encountered an issue that I can't seem to find any existing information about.
My current plan involves integrating PatrolJS into my project for pathfinding purposes. Once I resolve this particular problem, I anticipate that the implementation process should proceed smoothly. In my environment, I already have some NPC characters, and I've set up mouse interaction in 3D space to select and store data about clicked objects. I can successfully move my character to the click positions. The challenge lies in registering these clicks within the pathfinding area.
To better illustrate my query, please refer to this visual representation:
https://i.sstatic.net/SxO13.png
The image showcases my environment in simplified form, along with the navmesh area that I'm currently defining. Players will interact with various elements in the 3D environment/NPCs by clicking on them. While this functionality is functioning as intended, providing me with the intersection point in 3D space where the mouse cursor hovers, I need assistance in determining the closest point on the separate navmesh object to the clicked location on environmental objects.
If, for example, a player clicks on a specific section of a table, I aim to identify the nearest Vector 3 point on the navmesh object. This way, even if interactions occur outside the navigable area, I can establish endpoints and integrate them into PatrolJS effectively.