V2020.1.56.3_ Proximity Sensor
Overview
A ProximitySensor is a component that can detect objects in a specified detection field. At least one trigger collider needs to be assigned to function as the detection field for the ProximitySensor.
A Trigger Collider does not have to be on the same GameObject as the ProximitySensor
Where to find
The Proximity Sensor can be found under Standard Components >Proximity Sensor > Add Physical component.
This will add the Proximity Sensor component to the currently selected object or create a new empty GameObject with the component attached if no objects are selected.
The following inspector component will be shown:
Feature layout
The images below show the complete feature layout of the Proximity Sensor component.
Live Data |
|
State | Shows whether the sensor is currently active |
Output Signal | Low when no object is detected. High when at least one object is detected. |
Detected Objects (n) | The number of objects detected within all the Triggers |
Properties |
|
On Signal High() | Actions executed when Output Signal is set to high |
On Signal Low() | Actions executed when Output Signal is set to low |
Triggers (n) | The detection field for the Proximity Sensor |
Generate Rigidbodies | When checked creates Rigidbodies on the trigger objects when you enter play mode. |
Control Panel |
|
Generate Control Panel for SlideSwitch | Creates a Control Panel for the Proximity Sensor |
How to use
Create the Colliders to be used as the detection space for the Proximity Sensor and set them to be triggers
2. Add the trigger colliders as Triggers
3. Add an action to the Proximity Sensor
4. Test if the actions are activated in runtime
Prespective Documentation