Skip to main content

Range Sensor

The Range Sensor detects objects that are inside its detection volume. It uses the family of Overlap functions inside Physics or Physics2D. A detected object will have one or more Collider that overlaps the detection volume.


A Range Sensor detects nearby enemy ships

Output Signals

  • Object - Collider.gameObject or Collider.attachedRigidBody.gameObject depending on Detection Mode
  • Strength - Set to 1
  • Shape - The Bounds encapsulates all the Collider's associated to the Signal.

Each Signal may have been generated by multiple Colliders. This will happen when a GameObject has multiple Collider components. Also when the sensor is in Rigid Bodies mode there may be many Colliders that are children to a RigidBody. The signals shape encapsulates the Bounds of all the Colliders.

Configuration

Shape

There are several shapes to choose from. The 3D sensor has: Sphere, Box and Capsule. The 2D sensor has 2D equivalents. The shape you choose determines the underlying Physics function called. For example the Sphere shape will result in Physics.OverlapSphereNonAlloc and the Cube shape will result in Physics.OverlapBoxNonAlloc.

Layers

The Detects On Layers property is a layermask specifying what physics layers the sensor will detect Colliders on.

Filters

Any GameObject in the Ignore List will not be detected by the sensor. If the Tag Filter is enabled then a GameObject must have one of the specified tags for it to be detected.

API

API page