2023.1.1344.2 Contrast Sensor
Overview
The Contrast Sensor will match a detected color to its Base Color and its Background Color and give an output depending on which of the two colors matches most with the detected color.
A Contrast Sensor analysing three cubes for a Base color and a Background color. The Output Signal returns High for the red cube since it corresponds to the Base color, and low for the green and blue cubes since they correspond more to the Background color.
Where to find
The Contrast Sensor Physical and Logic components can be found under Standard Components > Color Sensor > Contrast Sensor > Add Physical Component.
It can be accessed from the GameObject menu as well as from the Hierarchy Context menu.
A new GameObject will be created if you do not have a GameObject selected. Otherwise, the Contrast Sensor will be added to the selected GameObject.
Feature layout - Physical Component
Live Data |
|
State | Shows whether the Contrast Sensor is currently active and thus whether it will detect a color. |
Output Signal | Shows whether or not the Contrast Sensor is currently detecting the Base Color or the Background Color. |
Match Percentage Base | The percentage with which the detected color matches the Base Color. |
Match Percentage Background | The percentage with which the detected color matches the Background Color. |
Properties |
|
Color Sensor | The specific Color Sensor to use for the Contrast Sensor. By default, a |
Base Color | The color which the detected color will be matched with for a High output value. |
Background Color | The color which the detected color will be matched with for a Low output value. |
On Signal High | A UnityEvent that is fired as soon as the Contrast Sensor has a High Output Signal. |
On Signal Low | A UnityEvent that is fired as soon as the Contrast Sensor has a Low Output Signal. |
Control Panel |
|
Generate Control Panel for ContrastSensor | Click this button to generate a ControlPanelInterface for the Contrast Sensor. |
Feature layout - Control Panel
Title | The Title of the Control Panel. Click to ping the target component in the hierarchy. Double click to edit. |
DCMotor Properties |
|
State | Shows whether the Contrast Sensor is currently active and thus whether it will detect a color. |
Output Signal | Shows whether or not the Contrast Sensor is currently detecting the Base Color or the Background Color. |
Enable/Disable | Enables/Disables the Contrast Sensor. |
Target Component |
|
Target Gameobject | The gameobject which has a standardcomponent you want the Control Panel for. |
Target Component | The Component which for which a Control Panel is generated. |
How to use
Assign a Contrast Sensor physical component to a GameObject, or create a new one directly from the menu.
Select the desired settings under the Properties tab.
In Play Mode, the Match Percentages of detected objects will be displayed, as well as the Output Signal.
Prespective Documentation