The Contrast Sensor will match a detected color to its Base Color and its Background Color to give an output depending on which of the two colors matches more 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.
It can also be accessed from the GameObject menu or 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
Shows whether the Contrast Sensor is currently active and thus whether it will detect a color
Shows whether or not the Contrast Sensor is currently detecting the Base Color or the Background Color
Match Percentage Base
The percentage by which the detected color matches the Base Color
Match Percentage Background
The percentage by which the detected color matches the Background Color
The specific Color Sensor to use for the Contrast Sensor. By default, a Color Sensor will automatically be assigned by either finding a suitable one in the scene or creating a new one
The color with which the detected color will be matched with for a High output value
The color with 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
Generate Control Panel for ContrastSensor
Click this button to generate a Control Panel for the Contrast Sensor
The Phyisical Contrast Sensor component attached to this Logic component
In the PLC I/O panel you can see the latest input and output values from the PLC
PLC settings and Debugging
These settings are general Logic Component settings.
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