From c88072166056ed9ca5b2e98ab8334fc149252e31 Mon Sep 17 00:00:00 2001 From: Index Date: Tue, 21 May 2024 17:00:34 -0500 Subject: [PATCH] Add NPC Pathfinding Documentation --- docs/objects/game/Environment.md | 14 +++++++++++++- docs/objects/world/NPC.md | 22 ++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/docs/objects/game/Environment.md b/docs/objects/game/Environment.md index 0f5c5ea..a3cb7f2 100644 --- a/docs/objects/game/Environment.md +++ b/docs/objects/game/Environment.md @@ -93,8 +93,20 @@ for i, hit in pairs(hits) do end ``` +### RebuildNavMesh { method } + +Rebuilds the navigation mesh which determines the empty space where NPCs can pathfind in. + ## Properties +### AutoGenerateNavMesh:bool { property } + +Determines whether or not to automatically build a navigation mesh for NPC pathfinding. This property is disabled by default so there are no performance issues with larger maps. + +
+!!! note "When updating the map, even if the property is set to true, you will still have to manually call the `Environment:BuildNavMesh()` method." +
+ ### FogColor:Color { property } The color of the fog. Fog is a visual effect that makes the world look like it is covered in a colored mist. @@ -135,4 +147,4 @@ game["Environment"].PartDestroyHeight = -2000 ### Skybox:SkyboxPreset { property } -The default skybox preset to use for the world, if no ImageSky is present. +The default skybox preset to use for the world, if no ImageSky is present. \ No newline at end of file diff --git a/docs/objects/world/NPC.md b/docs/objects/world/NPC.md index ab4708b..63fd1ed 100644 --- a/docs/objects/world/NPC.md +++ b/docs/objects/world/NPC.md @@ -50,6 +50,10 @@ Clears the NPC's appearance. npc:ClearAppearance() ``` +### SetNavDestination(position;Vector3) { method } + +Sets the destination for the NPC's pathfind. + ## Properties ### Anchored:bool { property } @@ -111,3 +115,21 @@ Specifies the color of the NPC's left leg. ### RightLegColor:Color { property } Specifies the color of the NPC's right leg. + +### NavDestinationDistance:number { property } + +Returns the remaining distance before the NPC reaches the end of its pathfind. + +{{ readonly() }} + +### NavDestinationValid:bool { property } + +Returns whether or not the NPC has a valid path to its set destination. + +{{ readonly() }} + +### NavDestinationReached:bool { property } + +Returns whether or not the NPC has reached the end of its pathfind. + +{{ readonly() }} \ No newline at end of file