Infohazard.HyperNav 1.1.5
3D Navigation for Flying Characters
|
A script that can be used to calculate paths by any entity that needs to use HyperNav for navigation. More...
Classes | |
class | PropNames |
This is used to refer to the names of private fields in this class from a custom Editor. More... | |
Public Member Functions | |
virtual void | Stop (bool abortPaths) |
Stop following the current path, and optionally cancel all path requests. More... | |
virtual void | UpdatePath () |
Request a new path from the current position to the desired destination. More... | |
Protected Member Functions | |
virtual void | Awake () |
Sets the AvoidanceAgent.Infohazard.HyperNav.AvoidanceAgent.InputVelocityFunc. More... | |
virtual void | OnEnable () |
Resets MeasuredVelocity and sets Arrived to true. More... | |
virtual void | OnDisable () |
Stops all pathfinding and cancels path requests. More... | |
virtual void | Update () |
Updates measured velocity and current index in path. More... | |
virtual void | OnDrawGizmos () |
Draws the current path as a sequence of debug lines if DebugPath is true. More... | |
virtual Vector3 | CalculateDesiredNavigationVelocity () |
Calculate the velocity the agent wants to move in, in the range [0, 1]. More... | |
virtual void | UpdateMeasuredVelocity () |
Update the value of MeasuredVelocity, which is used to determine StoppingDistance. More... | |
virtual void | UpdatePathIndex () |
Update the current path index, which is used to determine NextWaypoint. More... | |
virtual void | OnPathReady (long id, NavPath path) |
Callback that is received when a pathfinding request completes, which should start moving along that path. More... | |
Properties | |
float | Acceptance [get, set] |
How close the agent must get to a destination before it is considered to have arrived. More... | |
float | AccelerationEstimate [get, set] |
(Serialized) This should be set to the maximum acceleration of your agent. More... | |
float | SampleRadius [get, set] |
The radius to search when finding the nearest NavVolume. More... | |
float | DesiredSpeedRatio [get, set] |
The desired fraction of the maximum speed to travel at. More... | |
bool | DebugPath [get, set] |
Whether to draw a debug line in the scene view showing the agent's current path. More... | |
bool | KeepPathWhileCalculating [get, set] |
Whether to keep following the current path while waiting for a new path to finish calculating. More... | |
AvoidanceAgent | AvoidanceAgent [get, set] |
AvoidanceAgent that this agent uses for avoidance (can be null). More... | |
bool | ControlAvoidanceIsActive [get, set] |
If true, the Infohazard.HyperNav.AvoidanceAgent.IsActive state of the AvoidanceAgent is set based on whether there is a current valid path. More... | |
bool | IsPathPending [get] |
Whether a path is currently in the process of being calculated for this agent. More... | |
virtual float | StoppingDistance [get] |
The distance that it will take the agent to come to a stop from its current velocity, determined using the AccelerationEstimate. More... | |
Vector3 | NextWaypoint [get] |
The current path waypoint that the agent is trying to move towards. More... | |
bool | Arrived [get, private set] |
True if the agent has no active or pending path. More... | |
Vector3 | Destination [get, set] |
Get or set the agent's destination (the position it is trying to get to). More... | |
Vector3 | MeasuredVelocity [get, protected set] |
Velocity of the agent measured as delta position / delta time over the last frame, which is used to determine stopping distance. More... | |
NavPath | CurrentPath [get, set] |
The current path that the agent is following. More... | |
float | AvoidanceMaxSpeed [get, set] |
Maximum speed possible by this agent when avoiding obstacles. More... | |
Events | |
Action | PathReady |
Invoked when the agent finds a path to the destination. More... | |
Action | PathFailed |
Invoked when the agent fails to find a path to the destination. More... | |
Private Attributes | |
float | _acceptance = 1 |
(Serialized) How close the agent must get to a destination before it is considered to have arrived. More... | |
float | _accelerationEstimate = 0 |
(Serialized) This should be set to the maximum acceleration of your agent (can be set dynamically as well). More... | |
float | _sampleRadius = 2 |
(Serialized) The radius to search when finding the nearest NavVolume. More... | |
float | _desiredSpeedRatio = 1 |
(Serialized) The desired fraction of the maximum speed to travel at. More... | |
bool | _debugPath = true |
(Serialized) Whether to draw a debug line in the scene view showing the agent's current path. More... | |
bool | _keepPathWhileCalculating = true |
(Serialized) Whether to keep following the current path while waiting for a new path to finish calculating. More... | |
AvoidanceAgent | _avoidanceAgent |
(Serialized) AvoidanceAgent that this agent uses for avoidance (can be null). More... | |
bool | _controlAvoidanceIsActive = true |
(Serialized) If true, the Infohazard.HyperNav.AvoidanceAgent.IsActive state of the AvoidanceAgent is set based on whether there is a current valid path. More... | |
A script that can be used to calculate paths by any entity that needs to use HyperNav for navigation.
While a NavAgent is not necessary to use HyperNav, it makes pathfinding easier. The NavAgent does not impose any restrictions on how movement occurs, nor does it actually perform any movement. It simply provides a desired movement velocity, which other scripts on the object are responsible for using however they need.
The agent can have one active path (the path it is currently following), but can have multiple pending paths (paths in the process of being calculated by a NavPathfinder).
If you desire smoother movement then what the NavAgent provides, see SplineNavAgent.
|
protectedvirtual |
|
protectedvirtual |
Calculate the velocity the agent wants to move in, in the range [0, 1].
Reimplemented in Infohazard.HyperNav.SplineNavAgent.
|
protectedvirtual |
Stops all pathfinding and cancels path requests.
Reimplemented in Infohazard.HyperNav.SplineNavAgent.
|
protectedvirtual |
Draws the current path as a sequence of debug lines if DebugPath is true.
Reimplemented in Infohazard.HyperNav.SplineNavAgent.
|
protectedvirtual |
Resets MeasuredVelocity and sets Arrived to true.
|
protectedvirtual |
Callback that is received when a pathfinding request completes, which should start moving along that path.
id | The id of the path request. |
path | The completed path, which is null if no path was found. |
Reimplemented in Infohazard.HyperNav.SplineNavAgent.
|
virtual |
Stop following the current path, and optionally cancel all path requests.
abortPaths | Whether to cancel pending path requests. |
Reimplemented in Infohazard.HyperNav.SplineNavAgent.
|
protectedvirtual |
Updates measured velocity and current index in path.
Reimplemented in Infohazard.HyperNav.SplineNavAgent.
|
protectedvirtual |
Update the value of MeasuredVelocity, which is used to determine StoppingDistance.
|
virtual |
Request a new path from the current position to the desired destination.
It is usually not necessary to call this yourself, as it is called when setting Destination. However, if the agent gets stuck or pushed off course, you may wish to use this to get a new path.
|
protectedvirtual |
Update the current path index, which is used to determine NextWaypoint.
|
private |
(Serialized) This should be set to the maximum acceleration of your agent (can be set dynamically as well).
|
private |
(Serialized) How close the agent must get to a destination before it is considered to have arrived.
|
private |
(Serialized) AvoidanceAgent that this agent uses for avoidance (can be null).
|
private |
(Serialized) If true, the Infohazard.HyperNav.AvoidanceAgent.IsActive state of the AvoidanceAgent is set based on whether there is a current valid path.
|
private |
(Serialized) Whether to draw a debug line in the scene view showing the agent's current path.
|
private |
(Serialized) The desired fraction of the maximum speed to travel at.
|
private |
(Serialized) Whether to keep following the current path while waiting for a new path to finish calculating.
|
private |
(Serialized) The radius to search when finding the nearest NavVolume.
|
getset |
(Serialized) This should be set to the maximum acceleration of your agent.
This is used to determine when the agent needs to start slowing down when approaching its destination.
|
getset |
How close the agent must get to a destination before it is considered to have arrived.
Note that setting acceptance too low may prevent the agent from ever stopping, but setting it to high can make the agent stop too far from the destination.
|
getprivate set |
True if the agent has no active or pending path.
|
getset |
AvoidanceAgent that this agent uses for avoidance (can be null).
|
getset |
Maximum speed possible by this agent when avoiding obstacles.
|
getset |
If true, the Infohazard.HyperNav.AvoidanceAgent.IsActive state of the AvoidanceAgent is set based on whether there is a current valid path.
|
getset |
The current path that the agent is following.
|
getset |
Whether to draw a debug line in the scene view showing the agent's current path.
|
getset |
The desired fraction of the maximum speed to travel at.
|
getset |
Get or set the agent's destination (the position it is trying to get to).
If set within the _acceptance radius of the current position, will abort all movement.
|
get |
Whether a path is currently in the process of being calculated for this agent.
|
getset |
Whether to keep following the current path while waiting for a new path to finish calculating.
If true, there can be two pending paths at the same time - the most and least recently requested ones. This ensures that even when the agent is receiving pathfinding requests faster than they can be calculated, they will still finish and the agent will not be deadlocked and unable to ever complete a path.
|
getprotected set |
Velocity of the agent measured as delta position / delta time over the last frame, which is used to determine stopping distance.
This value is calculated in UpdateMeasuredVelocity. You can override that method to implement your own logic for calculating velocity.
|
get |
The current path waypoint that the agent is trying to move towards.
If there is no active path, will return the agent's current position.
|
getset |
The radius to search when finding the nearest NavVolume.
|
get |
The distance that it will take the agent to come to a stop from its current velocity, determined using the AccelerationEstimate.
Action Infohazard.HyperNav.NavAgent.PathFailed |
Invoked when the agent fails to find a path to the destination.
Action Infohazard.HyperNav.NavAgent.PathReady |
Invoked when the agent finds a path to the destination.