wiki.sine.space | sinespace

Difference between revisions of "Scripting/SNavMeshObstacle"

From wiki.sine.space
Jump to: navigation, search
(Created page with "The NavMeshObstacle allows users to describe moving obstacles that NavMeshAgents should avoid while navigating the world. =Properties= {{ScriptFunction|SVector|Center|{get...")
 
(Replaced content with "Thiss page has moved to: https://docs.sine.space/v/scripting/client-scripting/components/snavmeshobstacle")
 
Line 1: Line 1:
The NavMeshObstacle allows users to describe moving obstacles that NavMeshAgents should avoid while navigating the world.
+
Thiss page has moved to: https://docs.sine.space/v/scripting/client-scripting/components/snavmeshobstacle
 
+
 
+
=Properties=
+
 
+
 
+
{{ScriptFunction|SVector|Center|{get; set;}|Center of the obstacle geometry relative to the transform position.|5=agentobject = Space.Scene.Find("Cube")<br>
+
agent = agentobject.NavMeshAgent<br>
+
if agent == nil then<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;agent = Space.Scene.Find("Cube").AddNavMeshAgent()<br>
+
end<br>
+
navobstacle = Space.Scene.Find("Obstacle")<br>
+
''--get obstacle component.''<br>
+
obstacle = navobstacle.NavMeshObstacle<br>
+
obstacle.Center = Vector.New(1,1,1)<br>
+
Space.Log(obstacle.Center.ToString())<br>
+
''--set geometry to 1,1,1 .''
+
}}
+
 
+
{{ScriptFunction|float|Height|{get; set;}|Height of the capsule. (Property of Capsule shape).|5=agentobject = Space.Scene.Find("Cube")<br>
+
agent = agentobject.NavMeshAgent<br>
+
if agent == nil then<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;agent = Space.Scene.Find("Cube").AddNavMeshAgent()<br>
+
end<br>
+
navobstacle = Space.Scene.Find("Obstacle")<br>
+
''--get obstacle component.''<br>
+
obstacle = navobstacle.NavMeshObstacle<br>
+
obstacle.Shape = 0<br>
+
obstacle.Height = 40<br>
+
Space.Log(obstacle.Height)<br>
+
''--set shape to capsule and set height to 40.''
+
}}
+
 
+
{{ScriptFunction|SVector|Size|{get; set;}|Size of the box. (Property of Box shape).|5=agentobject = Space.Scene.Find("Cube")<br>
+
agent = agentobject.NavMeshAgent<br>
+
if agent == nil then<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;agent = Space.Scene.Find("Cube").AddNavMeshAgent()<br>
+
end<br>
+
navobstacle = Space.Scene.Find("Obstacle")<br>
+
''--get obstacle component.''<br>
+
obstacle = navobstacle.NavMeshObstacle<br>
+
obstacle.Shape = 1<br>
+
obstacle.Size = Vector.New(5,10,15)<br>
+
''--set shape to box and set length, width, height to 5,10,15.''
+
}}
+
 
+
{{ScriptFunction|bool|Carving|{get; set;}|When the Carve checkbox gets ticked, the Nav Mesh Obstacle creates a hole in the NavMesh.|5=agentobject = Space.Scene.Find("Cube")<br>
+
agent = agentobject.NavMeshAgent<br>
+
if agent == nil then<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;agent = Space.Scene.Find("Cube").AddNavMeshAgent()<br>
+
end<br>
+
navobstacle = Space.Scene.Find("Obstacle")<br>
+
''--get obstacle component.''<br>
+
obstacle = navobstacle.NavMeshObstacle<br>
+
obstacle.Carving = true<br>
+
Space.Log(obstacle.Carving)<br>
+
''--enable carving and return the status of it.''
+
}}
+
 
+
{{ScriptFunction|float|MoveThreshold|{get; set;}|Use this property to set the threshold distance for updating a moving carved hole. (Only can take effect after carve was ticked)
+
|5=agentobject = Space.Scene.Find("Cube")<br>
+
agent = agentobject.NavMeshAgent<br>
+
if agent == nil then<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;agent = Space.Scene.Find("Cube").AddNavMeshAgent()<br>
+
end<br>
+
navobstacle = Space.Scene.Find("Obstacle")<br>
+
''--get obstacle component.''<br>
+
obstacle = navobstacle.NavMeshObstacle<br>
+
obstacle.Carving = true<br>
+
obstacle.MoveThreshold = 5<br>
+
''--set move threshold to 5.''
+
}}
+
 
+
{{ScriptFunction|float|TimeToStationary|{get; set;}| The time to wait until the obstacle is treated as stationary. (Only can take effect after carve was ticked).
+
|5=agentobject = Space.Scene.Find("Cube")<br>
+
agent = agentobject.NavMeshAgent<br>
+
if agent == nil then<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;agent = Space.Scene.Find("Cube").AddNavMeshAgent()<br>
+
end<br>
+
navobstacle = Space.Scene.Find("Obstacle")<br>
+
''--get obstacle component.''<br>
+
obstacle = navobstacle.NavMeshObstacle<br>
+
obstacle.Carving = true<br>
+
obstacle.TimeToStationary = 5<br>
+
'' --set time to stationary to 5.''
+
}}
+
 
+
{{ScriptFunction|bool|CarveOnlyStationary|{get; set;}| When enabled, the obstacle is carved only when it is stationary. (Only can enabled after carve was ticked).
+
|5=agentobject = Space.Scene.Find("Cube")<br>
+
agent = agentobject.NavMeshAgent<br>
+
if agent == nil then<br>
+
&nbsp;&nbsp;&nbsp;&nbsp;agent = Space.Scene.Find("Cube").AddNavMeshAgent()<br>
+
end<br>
+
navobstacle = Space.Scene.Find("Obstacle")<br>
+
''--get obstacle component.''<br>
+
obstacle = navobstacle.NavMeshObstacle<br>
+
obstacle.Carving = true<br>
+
obstacle.CarveOnlyStationary = false<br>
+
'' --disable carve only stationary.''
+
}}
+
 
+
 
+
{{Scripting Navbox}}
+

Latest revision as of 06:12, 19 September 2022

Thiss page has moved to: https://docs.sine.space/v/scripting/client-scripting/components/snavmeshobstacle