Color Sensor
The color sensor component detects the presence of an entity and its color. For more details on all properties associated with the color sensor component and how to use the color sensor component with scripting, please see the API documentation.
The detected color is determined by performing a graphics raycast, then by measuring the base color and texture of the mesh.
Properties
The color sensor component properties that are accessible through the inspector.
Origin
The start of the detection beam. You can click the feature selection button to select a feature from the mesh. Hover over the feature you want to select and then left-click to confirm the selection.
Direction
The direction of the detection beam. You can click the feature selection button to select a feature from the mesh. Hover over the feature you want to select then left-click to confirm the selection. You can right click whilst hovering to negate the direction vector.
Range
The maximum range of the color sensor.
Tolerance
The tolerance used to determine whether a color has been detected. This is determined by using a distance metric from the measured color to any color in the programmed array of colors.
Colors
The programmed array of colors which can be detected.
Color
The detected color index, or -1 if no color is detected.
Object
The detected entity, or null if no entity is detected.
Blocked
The graphics material used when the color sensor is blocked, or null to keep using the material specified by the graphics component.
Cleared
The graphics material used when the color sensor is cleared, or null to keep using the material specified by the graphics component.
IO
The IO signals for the color sensor component. Please see the ColorSensorIO API documentation for more details.
Color
A int8 readable (output) signal that stores the detected color index. The value will be -1 if the color sensor does not detect an entity.
State
A boolean readable (output) signal that has the value true if the color sensor detects an entity, and false if the color sensor does not detect an entity.