wiki.sine.space | sinespace

Difference between revisions of "Scripting/SNavMeshAgent"

From wiki.sine.space
Jump to: navigation, search
(Created page with "Navigation mesh agent. is attached to a mobile character in the game to allow it to navigate the Scene using the NavMesh. =Members= {{ScriptFunction|void|Move|(SVector mov...")
 
Line 72: Line 72:
 
agent.Wrap(Vector.New(2,0,0)+agent.GameObject.WorldPosition)<br>
 
agent.Wrap(Vector.New(2,0,0)+agent.GameObject.WorldPosition)<br>
 
'' --Wrap forward 2 meters.''
 
'' --Wrap forward 2 meters.''
 +
}}
 +
 +
=Properties=
 +
{{ScriptFunction|bool|Enabled|{get; set;}|Enable or disable this component.|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>
 +
agent.Enabled = false<br>
 +
'' --disable navmesh agent.''
 +
}}
 +
 +
{{ScriptFunction|float|Accelleration|{get; set;}|The maximum acceleration of an agent as it follows a path.|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>
 +
agent.Accelleration = 60<br>
 +
'' --set accellratioon to 60.''
 +
}}
 +
 +
{{ScriptFunction|float|Accelleration|{get; set;}|The maximum acceleration of an agent as it follows a path.|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>
 +
agent.Accelleration = 60<br>
 +
'' --set accellratioon to 60.''
 +
}}
 +
 +
{{ScriptFunction|float|AngularSpeed|{get; set;}|Maximum turning speed in while following a path.|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>
 +
agent.AngularSpeed = 60<br>
 +
'' --set AngularSpeed to 60.''
 +
}}
 +
 +
{{ScriptFunction|int|AreaMask|{get; set;}| Specifies which NavMesh area is passable.|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>
 +
agent.AreaMask = 3<br>
 +
''  --set AreaMask to layer1 and layer2.''
 +
}}
 +
 +
{{ScriptFunction|bool|AutoRepath|{get; set;}| Set the agent attempt to acquire a new path if the existing path becomes invalid.|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>
 +
agent.AutoRepath = false<br>
 +
''--set AutoRepath false.''
 +
}}
 +
 +
{{ScriptFunction|bool|AutoBraking|{get; set;}| Set the agent brake automatically to avoid overshooting the destination point.|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>
 +
agent.AutoBraking = false<br>
 +
''--set AutoBraking false.''
 +
}}
 +
 +
{{ScriptFunction|bool|AutoTraverseOffMeshLink|{get; set;}| Set the agent move across OffMeshLinks automatically.|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>
 +
agent.AutoTraverseOffMeshLink = false<br>
 +
''--set AutoTraverseOffMeshLink false.''
 +
}}
 +
 +
{{ScriptFunction|int|AvoidancePriority|{get; set;}|The avoidance priority level.|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>
 +
agent.AvoidancePriority = 60<br>
 +
''--set AvoidancePriority to 60.''
 +
}}
 +
 +
{{ScriptFunction|float|BaseOffset|{get; set;}|The relative vertical displacement of the GameObject.|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>
 +
agent.BaseOffset = 3<br>
 +
''--set BaseOffset to 3.''
 +
}}
 +
 +
{{ScriptFunction|SVector|DesiredVelocity|{get;}| The desired velocity of the agent including any potential contribution from avoidance.|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>
 +
Space.Log(agent.DesiredVelocity.ToString())<br>
 +
''--output the desired velocity.''
 +
}}
 +
 +
{{ScriptFunction|SVector|Destination|{get; set;}| The desired velocity of the agent including any potential contribution from avoidance.|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>
 +
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition<br>
 +
''--set destination for target transforming.''
 +
}}
 +
 +
{{ScriptFunction|bool|HasPath|{get;}|Does the agent currently have a path?|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>
 +
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition<br>
 +
Space.Log(agent.HasPath)<br>
 +
''--Return has path or not.''
 +
}}
 +
 +
{{ScriptFunction|float|Height|{get; set;}|The height of the agent for purposes of passing under obstacles, etc.|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>
 +
agent.Height = 60<br>
 +
'' --set height to 60.''
 +
}}
 +
 +
 +
{{ScriptFunction|bool|IsOnNavMesh|{get;}|Is the agent currently bound to 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>
 +
Space.Log(agent.IsOnNavMesh)<br>
 +
''--output this agent is on the navmesh.''
 +
}}
 +
 +
{{ScriptFunction|bool|IsOnOffMeshLink|{get;}| Is the agent currently positioned on an OffMeshLink?|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>
 +
Space.Log(agent.IsOnOffMeshLink)<br>
 +
''--output this agent is on off meshlink.''
 +
}}
 +
 +
{{ScriptFunction|bool|IsPathStale|{get;}|Is the current path stale?|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>
 +
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition<br>
 +
Space.Log(agent.IsPathStale)<br>
 +
''--output the path is stale.''
 +
}}
 +
 +
{{ScriptFunction|SVector|NextPosition|{get; set;}|Get or set the simulation position of the navmesh agent.|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>
 +
function OutputNextPosition()<br>
 +
&nbsp;&nbsp;&nbsp;&nbsp;Space.Log(agent.NextPosition)<br>
 +
end<br>
 +
agentobject.SubscribeToEvents()<br>
 +
agentobject.OnUpdate(OutputNextPosition)<br>
 +
''--register update events to navmesh agent's game object''<br>
 +
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition<br>
 +
''--set destination.''
 +
}}
 +
 +
{{ScriptFunction|SVector|PathEndPosition|{get;}|End positon of navigation.|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>
 +
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition<br>
 +
Space.Log(agent.PatchEndPosition)<br>
 +
''--output the end position of the navmesh agent.''
 +
}}
 +
 +
 +
{{ScriptFunction|bool|PathPending|{get;}|Is a path in the process of being computed but not yet ready?|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>
 +
function OutputPathPending()<br>
 +
&nbsp;&nbsp;&nbsp;&nbsp;Space.Log(agent.PathPending)<br>
 +
end<br>
 +
agentobject.SubscribeToEvents()<br>
 +
agentobject.OnUpdate(OutputPathPending)<br>
 +
''--register update events to navmesh agent's game object''<br>
 +
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition<br>
 +
''--set destination.''
 +
}}
 +
 +
{{ScriptFunction|float|Radius|{get; set;}|The avoidance radius for the agent.|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>
 +
agent.Radius = 5<br>
 +
''--set radius of agent to 5.''
 +
}}
 +
 +
{{ScriptFunction|float|RemainingDistance|{get;}|The distance between the agent's position and the destination on the current path.|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>
 +
function OutputRemainingDistance()<br>
 +
&nbsp;&nbsp;&nbsp;&nbsp;Space.Log(agent.RemainingDistance)<br>
 +
end<br>
 +
agentobject.SubscribeToEvents()<br>
 +
agentobject.OnUpdate(OutputRemainingDistance)<br>
 +
''--register update events to navmesh agent's game object''<br>
 +
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition<br>
 +
''--set destination.''
 +
}}
 +
 +
{{ScriptFunction|float|Speed|{get; set;}|Maximum movement speed when following a path.|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>
 +
agent.Speed = 20<br>
 +
''--set speed to 20.''<br>
 +
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition<br>
 +
''--set destination.''
 +
}}
 +
 +
{{ScriptFunction|SVector|SteeringTarget|{get;}|Get the current steering target along the path.|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>
 +
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition<br>
 +
''--set destination.''<br>
 +
Space.Log(agent.SteeringTarget.ToString())<br>
 +
''--output steering target position.''
 +
}}
 +
 +
{{ScriptFunction|float|StoppingDistance|{get; set;}|Stop within this distance from the target 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>
 +
agent.StoppingDistance = 2<br>
 +
''--set stopping distance.''
 +
}}
 +
 +
{{ScriptFunction|bool|UpdatePosition|{get; set;}Get or set whether the transform position is synchronized with the simulated agent 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>
 +
agent.UpdatePosition = false<br>
 +
''--set update position to false.''<br>
 +
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition<br>
 +
''--set destination.''
 +
}}
 +
 +
{{ScriptFunction|bool|UpdatePosition|{get; set;}Should the agent update the transform orientation?|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>
 +
agent.UpdateRotation = false<br>
 +
''--set update Rotation to false.''<br>
 +
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition<br>
 +
''--set destination.''
 +
}}
 +
 +
{{ScriptFunction|SVector|Velocity|{get;}|access the current velocity of the NavMeshAgent component, or set a velocity to control the agent manually.|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>
 +
function OutputVelocity()<br>
 +
&nbsp;&nbsp;&nbsp;&nbsp;Space.Log("Velocity is : " .. agent.Velocity.ToString())<br>
 +
end<br>
 +
agentobject.SubscribeToEvents()<br>
 +
agentobject.OnUpdate(OutputRemainingDistance)<br>
 +
''--register update events to navmesh agent's game object''<br>
 +
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition<br>
 +
''--set destination.''
 
}}
 
}}
  
 
{{Scripting Navbox}}
 
{{Scripting Navbox}}

Revision as of 05:28, 22 December 2020

Navigation mesh agent. is attached to a mobile character in the game to allow it to navigate the Scene using the NavMesh.


Members

Move

void Move (SVector movement);

Apply relative movement to current position.

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.Move(Vector.New(2,0,0))

--move forward 2 meters.


Resume

void Resume ();

Resume the NavMesh agent.

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
counts = 0
--stop first, then resume.
function StopAndResume()
    counts = counts +1
    if counts > 10 then
      agent.Stop()
    end
    if counts > 50 then
      agent.Resume()
    end
end
agentobject.SubscribeToEvents()
agentobject.OnUpdate(StopAndResume)
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition

--set destination.


SetAreaCost

void SetAreaCost (int areaIndex, float cost);

Sets the cost for traversing over areas of the area type.

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.SetAreaCost(2,20)

--set area 2 cost to 20.


Stop

void Stop ();

To stop the NavMesh agent.

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition
--set destination.
agent.Stop()

--stop the agent.


SetDestination

void SetDestination (SVector position);

Set or update the destination.

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.SetDestination(Space.Scene.Find("TargetTransform").WorldPosition)

--set destination.


Wrap

void Wrap (SVector position);

Wrap to the position you want, also you can set agent's world position and vector to make this act as Move(SVector position).

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.Wrap(Vector.New(2,0,0)+agent.GameObject.WorldPosition)

--Wrap forward 2 meters.


Properties

Enabled

bool Enabled {get; set;}

Enable or disable this component.

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.Enabled = false

--disable navmesh agent.


Accelleration

float Accelleration {get; set;}

The maximum acceleration of an agent as it follows a path.

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.Accelleration = 60

--set accellratioon to 60.


Accelleration

float Accelleration {get; set;}

The maximum acceleration of an agent as it follows a path.

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.Accelleration = 60

--set accellratioon to 60.


AngularSpeed

float AngularSpeed {get; set;}

Maximum turning speed in while following a path.

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.AngularSpeed = 60

--set AngularSpeed to 60.


AreaMask

int AreaMask {get; set;}
Specifies which NavMesh area is passable.
agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.AreaMask = 3

--set AreaMask to layer1 and layer2.


AutoRepath

bool AutoRepath {get; set;}
Set the agent attempt to acquire a new path if the existing path becomes invalid.
agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.AutoRepath = false

--set AutoRepath false.


AutoBraking

bool AutoBraking {get; set;}
Set the agent brake automatically to avoid overshooting the destination point.
agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.AutoBraking = false

--set AutoBraking false.


AutoTraverseOffMeshLink

bool AutoTraverseOffMeshLink {get; set;}
Set the agent move across OffMeshLinks automatically.
agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.AutoTraverseOffMeshLink = false

--set AutoTraverseOffMeshLink false.


AvoidancePriority

int AvoidancePriority {get; set;}

The avoidance priority level.

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.AvoidancePriority = 60

--set AvoidancePriority to 60.


BaseOffset

float BaseOffset {get; set;}

The relative vertical displacement of the GameObject.

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.BaseOffset = 3

--set BaseOffset to 3.


DesiredVelocity

SVector DesiredVelocity {get;}
The desired velocity of the agent including any potential contribution from avoidance.
agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
Space.Log(agent.DesiredVelocity.ToString())

--output the desired velocity.


Destination

SVector Destination {get; set;}
The desired velocity of the agent including any potential contribution from avoidance.
agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end

agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition
--set destination for target transforming.


HasPath

bool HasPath {get;}

Does the agent currently have a path?

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition
Space.Log(agent.HasPath)

--Return has path or not.


Height

float Height {get; set;}

The height of the agent for purposes of passing under obstacles, etc.

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.Height = 60

--set height to 60.



IsOnNavMesh

bool IsOnNavMesh {get;}

Is the agent currently bound to the navmesh?

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
Space.Log(agent.IsOnNavMesh)

--output this agent is on the navmesh.


IsOnOffMeshLink

bool IsOnOffMeshLink {get;}
Is the agent currently positioned on an OffMeshLink?
agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
Space.Log(agent.IsOnOffMeshLink)

--output this agent is on off meshlink.


IsPathStale

bool IsPathStale {get;}

Is the current path stale?

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition
Space.Log(agent.IsPathStale)

--output the path is stale.


NextPosition

SVector NextPosition {get; set;}

Get or set the simulation position of the navmesh agent.

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
function OutputNextPosition()
    Space.Log(agent.NextPosition)
end
agentobject.SubscribeToEvents()
agentobject.OnUpdate(OutputNextPosition)
--register update events to navmesh agent's game object
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition

--set destination.


PathEndPosition

SVector PathEndPosition {get;}

End positon of navigation.

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition
Space.Log(agent.PatchEndPosition)

--output the end position of the navmesh agent.



PathPending

bool PathPending {get;}

Is a path in the process of being computed but not yet ready?

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
function OutputPathPending()
    Space.Log(agent.PathPending)
end
agentobject.SubscribeToEvents()
agentobject.OnUpdate(OutputPathPending)
--register update events to navmesh agent's game object
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition

--set destination.


Radius

float Radius {get; set;}

The avoidance radius for the agent.

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.Radius = 5

--set radius of agent to 5.


RemainingDistance

float RemainingDistance {get;}

The distance between the agent's position and the destination on the current path.

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
function OutputRemainingDistance()
    Space.Log(agent.RemainingDistance)
end
agentobject.SubscribeToEvents()
agentobject.OnUpdate(OutputRemainingDistance)
--register update events to navmesh agent's game object
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition

--set destination.


Speed

float Speed {get; set;}

Maximum movement speed when following a path.

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.Speed = 20
--set speed to 20.
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition

--set destination.


SteeringTarget

SVector SteeringTarget {get;}

Get the current steering target along the path.

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition
--set destination.
Space.Log(agent.SteeringTarget.ToString())

--output steering target position.


StoppingDistance

float StoppingDistance {get; set;}

Stop within this distance from the target position.

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.StoppingDistance = 2

--set stopping distance.


UpdatePosition

bool UpdatePosition {get; set;}Get or set whether the transform position is synchronized with the simulated agent position.

No documentation

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.UpdatePosition = false
--set update position to false.
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition

--set destination.


UpdatePosition

bool UpdatePosition {get; set;}Should the agent update the transform orientation?

No documentation

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
agent.UpdateRotation = false
--set update Rotation to false.
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition

--set destination.


Velocity

SVector Velocity {get;}

access the current velocity of the NavMeshAgent component, or set a velocity to control the agent manually.

agentobject = Space.Scene.Find("Cube")

agent = agentobject.NavMeshAgent
if agent == nil then
    agent = Space.Scene.Find("Cube").AddNavMeshAgent()
end
function OutputVelocity()
    Space.Log("Velocity is : " .. agent.Velocity.ToString())
end
agentobject.SubscribeToEvents()
agentobject.OnUpdate(OutputRemainingDistance)
--register update events to navmesh agent's game object
agent.Destination = Space.Scene.Find("TargetTransform").WorldPosition

--set destination.