NavMeshSensor
A wrapper around the built-in navmesh functions.
Properties
Test
Which nav mesh function to use. Can be one of Ray
, Sample
, ClosestEdge
.
Ray
Parameters for the Ray
test. These will be parameters for NavMesh.Raycast
.
Sphere
Parameters for either Sample
or ClosestEdge
test. This is the search radius for these features.
AreaMask
Bitmask over the navmesh area ids.
PulseMode
One of EachFrame
, FixedInterval
or Manual
.
PulseInterval
If PulseMode
is set to FixedInterval
, this is the time in seconds between each pulse.
IsObstructed
Boolean specifying if the ray is currently obstructed.
Events
OnObstruction
UnityEvent<IObstructionSensor>
invoked when the sensor is obstructed and was previously unobstructed.
OnClear
UnityEvent<IObstructionSensor>
invoked when the sensor becomes unobstructed when it was previously obstructed.
Methods
GetDetectionRayHit(gameObject)
RayHit GetDetectionRayHit(GameObject detectedGameObject)
Will always return RayHit.None
since this sensor doesn't detect objects. Use GetObstructionRayHit()
instead.
GetObstructionRayHit()
RayHit GetObstruction()
Returns RayHit
data for the current obstruction.