A script that can be used to calculate smooth paths by any entity that needs to use HyperNav for navigation.
More...
|
override void | Update () |
| Updates measured velocity and finds the nearest point on the spline. More...
|
|
override void | OnDrawGizmos () |
| Draws the current spline if NavAgent.DebugPath is true. More...
|
|
override Vector3 | CalculateDesiredNavigationVelocity () |
| Calculate the velocity the agent wants to move in, in the range [0, 1]. More...
|
|
override void | OnPathReady (long id, NavPath path) |
| Callback that is received when a pathfinding request completes, which should start moving along that path. - Parameters
-
id | The id of the path request. |
path | The completed path, which is null if no path was found. |
More...
|
|
override void | OnDisable () |
| Stops all pathfinding and cancels path requests. More...
|
|
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...
|
|
|
float | TangentScale [get, set] |
| Scale to apply to spline tangents (lower values make the spline less curvy). More...
|
|
bool | RaycastTangents [get, set] |
| Whether to shorten tangents by raycasting to ensure they don't penetrate blocked areas. More...
|
|
int | DistanceSamplesPerSegment [get, set] |
| How many samples to take per segment of the spline when mapping the distance. More...
|
|
int | DebugPointCount [get, set] |
| If NavAgent.DebugPath is enabled, how many points to use to draw the curve. More...
|
|
float | MaxAlignmentVelocityDistance [get, set] |
| At what distance from the spline the agent will have all its desired velocity devoted to returning. More...
|
|
float | CurvatureSampleDistance [get, set] |
| Delta-T to use when sampling curvature (should be quite small). More...
|
|
float | CurvatureOfMaxSlowdown [get, set] |
| At what curvature value is the agent at its max curvature slowdown. More...
|
|
float | MaxCurvatureSlowdown [get, set] |
| The multiplier on desired tangent velocity when at the max curvature value. More...
|
|
bool | DebugProjectOnSpline [get, set] |
| Whether to draw debug lines when projecting on the spline. More...
|
|
float | BlockedDetectionDistance [get, set] |
| Distance in front of the agent to check to see if it needs to avoid level geometry. More...
|
|
float | BlockedDetectionBackDistance [get, set] |
| Distance behind the agent to check to see if it needs to avoid level geometry. More...
|
|
float | BlockedDetectionMinSplineDistance [get, set] |
| How far the agent must be from the spline to check for blocking level geometry. More...
|
|
SplinePath | SplinePath [get] |
| The spline that the agent is currently following. More...
|
|
float | CurrentSplineParameter [get] |
| The spline parameter value the agent is nearest to on the spline. More...
|
|
float | CurrentSplineDistance [get] |
| The distance along the spline the agent is nearest to. More...
|
|
float | MaxSplineDistance [get] |
| The length of the agent's current spline path. More...
|
|
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...
|
|
A script that can be used to calculate smooth paths by any entity that needs to use HyperNav for navigation.
A SplineNavAgent works just like (and is a subclass of) NavAgent. However, a SplineNavAgent feeds the path waypoints into a spline function to get a smoother path. In order to follow the spline, the SplineNavAgent creates its NavAgent.DesiredVelocity based on two factors:
-
Tangent: The direction the spline is pointing nearest the agent.
-
Alignment: The direction from the agent to the nearest point on the spline.
The agent will increase the influence of the alignment velocity the further it gets from the spline, in order to prevent drifting too far off. Additionally, the agent can slow down its desired tangent velocity on high-curvature regions, in order to take the curves more slowly.