The NavMeshObstacle allows users to describe moving obstacles that NavMeshAgents should avoid while navigating the world.
Center of the obstacle geometry relative to the transform position.
agent = agentobject.NavMeshAgent
if agent == nil then
agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
navobstacle = Space.Scene.Find("Obstacle")
--get obstacle component.
obstacle = navobstacle.NavMeshObstacle
obstacle.Center = Vector.New(1,1,1)
Space.Log(obstacle.Center.ToString())
Height of the capsule. (Property of Capsule shape).
agent = agentobject.NavMeshAgent
if agent == nil then
agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
navobstacle = Space.Scene.Find("Obstacle")
--get obstacle component.
obstacle = navobstacle.NavMeshObstacle
obstacle.Shape = 0
obstacle.Height = 40
Space.Log(obstacle.Height)
Size of the box. (Property of Box shape).
agent = agentobject.NavMeshAgent
if agent == nil then
agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
navobstacle = Space.Scene.Find("Obstacle")
--get obstacle component.
obstacle = navobstacle.NavMeshObstacle
obstacle.Shape = 1
obstacle.Size = Vector.New(5,10,15)
When the Carve checkbox gets ticked, the Nav Mesh Obstacle creates a hole in the NavMesh.
agent = agentobject.NavMeshAgent
if agent == nil then
agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
navobstacle = Space.Scene.Find("Obstacle")
--get obstacle component.
obstacle = navobstacle.NavMeshObstacle
obstacle.Carving = true
Space.Log(obstacle.Carving)
Use this property to set the threshold distance for updating a moving carved hole. (Only can take effect after carve was ticked)
agent = agentobject.NavMeshAgent
if agent == nil then
agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
navobstacle = Space.Scene.Find("Obstacle")
--get obstacle component.
obstacle = navobstacle.NavMeshObstacle
obstacle.Carving = true
obstacle.MoveThreshold = 5
The time to wait until the obstacle is treated as stationary. (Only can take effect after carve was ticked).
agent = agentobject.NavMeshAgent
if agent == nil then
agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
navobstacle = Space.Scene.Find("Obstacle")
--get obstacle component.
obstacle = navobstacle.NavMeshObstacle
obstacle.Carving = true
obstacle.TimeToStationary = 5
When enabled, the obstacle is carved only when it is stationary. (Only can enabled after carve was ticked).
agent = agentobject.NavMeshAgent
if agent == nil then
agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
navobstacle = Space.Scene.Find("Obstacle")
--get obstacle component.
obstacle = navobstacle.NavMeshObstacle
obstacle.Carving = true
obstacle.CarveOnlyStationary = false
|