Click or drag to resize

Sensor 2D

Fixed Constraint 2DManual / Base Types / 2D / Sensor 2DDestroying Sensor 2D

Sensor 2D

The event trigger in the scene with 2D physics support.

For a good overview of sensors, you can take a look at the 'Sensors 2D.scene' file, which can be found in 'Assets\Samples\Starter Content\Scenes'.

Screenshot999999999999179.png
Overview

The sensor allows you to select scene objects by a given volume or ray.

The parameter 'Source Data' indicates what type of objects will be determined: scene objects or physical bodies.

In order to see which objects the sensor has selected, you need to enable the 'Display Objects' parameter.

Properties
Name Description
Source Data What kind of data is used as a source of events.
Shape The shape of the trigger.
Ray Target The target by which the sensor ray will trigger.
Mode The recognition mode of the sensor.
Filter By Type The type of objects that sensor will recognize.
Collision Categories The collision categories this fixture is a part of.
Collides With The collision mask bits. This states the categories that this fixture would accept for collision.
Collision Group Collision groups allow a certain group of objects to never collide or always collide. Zero means no collision group. Non-zero group filtering always wins against the mask bits.
Ignore Sensors Whether the sensor is ignoring other sensors.
When Update The update case mode of the sensor.
Display Color The display color of the sensor.
Display Objects Whether to draw gizmos on the objects recognized by the sensor.
Display Objects Color The color of the recognized object gizmos.
Objects List of objects recognized by the sensor.
See also
Fixed Constraint 2DDestroying Sensor 2D