ProximitySensor
class in OpalScript
Detects nearby objects in a radius or facing cone, with optional group, component and line-of-sight filters. Does not move or attack.
Properties
| Member | Description |
|---|---|
| ProximitySensor.NearestId | Read-only runtime value. Use component methods to change state. |
| ProximitySensor.Count | Read-only runtime value. Use component methods to change state. |
| ProximitySensor.Enabled | Whether this component is enabled. Use SetEnabled to change it. |
Methods
| Member | Description |
|---|---|
| ProximitySensor.SetEnabled | Enables sensing, or disables it and clears detected IDs and count immediately. |
| ProximitySensor.HasTargets | Returns true when the latest scan detected at least one object. |
Events
| Member | Description |
|---|---|
| ProximitySensor.entered | Emits an object's ID when it first satisfies this sensor's range and filters. |
| ProximitySensor.exited | Emits an object's ID when it leaves the range or no longer satisfies the filters. |
| ProximitySensor.nearestChanged | Emits the previous and current nearest object IDs; an empty ID means no detected object. |