Physical Trigger

Chapters:

A physical trigger is an object firing callbacks when physical objects get inside or outside of it.
There are 4 types of the physical triggers based on their shape:

Sphere trigger of the specified radius.

Capsule trigger of the specified radius and height.

Cylinder trigger of the specified radius and height.

Box trigger of the specified size along the axes.

To be detected by the trigger a physical object must have both a physical body (with the physical mask that matches the physical mask of the trigger) and a shape (with the collision mask that matches the collision mask of the trigger).

It is also possible to specify the exclusion mask for the physical trigger that is used to prevent detecting collisions with shapes.
This mask is independent of the collision mask.

For a body with a shape, the exclusion mask can be set on the Physics tab of the Parameters panel.

To avoid collision detection between a shape and a physical trigger, the following conditions must be met:

The collision mask set for the shape must match the collision mask of the physical trigger.

The exclusion mask set for the shape must match the exclusion mask of the physical trigger.

Physical objects participating in the contact with the physical trigger can be obtained via C++, C# or UnigineScript API. The shape of such object can also be obtained.
Moreover, you can get the depth of the object penetration, coordinates of the contact point and its normal.

The new physical trigger node will be added to UnigineEditor and you will be able to edit it via the Parameters window.
By default, the sphere trigger with 1 -unit radius is created.

Editing Physical Trigger

On the Physical Trigger tab of the Parameters window, you can adjust the following parameters of the physical trigger:

Edit Size

Toggles the editing mode for the physical trigger node. When enabled, the size or the radius of the node (depending on its type) can be changed: each side/axis is highlighted with the colored rectangle/circle. To change the size/radius, drag the corresponding rectangle/circle.

Editing of Sphere-Shaped Physical Trigger

Physical Mask

Physical mask. The physical mask of the physical trigger must match the physical mask of the physical object. Otherwise, the physical trigger won't fire callbacks when the object enters or leaves it.

Collision

Collision mask.

In case of the physical object, the collision mask of the physical trigger must match
the collision mask of the physical object's shape.

In case of the non-physical collider object, the collision mask of the physical trigger must match the collision mask of the object's surface.

Type

Type of the physical trigger: sphere, capsule, cylinder or box.

Size

Size of the physical trigger, namely:

Radius, in case of a sphere.

Radius and height, in case of a capsule or a cylinder.

Dimensions, in case of a box.

Enter

Name of the world script callback function to be fired on entering the physical trigger.

Leave

Name of the world script callback function to be fired on leaving the physical trigger.

Last update: 2018-06-04

We use cookies to ensure that we give you the best experience on our website. Click here for more information.