sm.areaTrigger
Associated object type: AreaTrigger
An area trigger is an invisible collider in the world that can trigger events when objects move in or out of it. This allows the script to, for instance, detect when a character enters a door, or count the number of shapes there are in a room.
Example usage:
function MyClass.server_onCreate( self ) local size = sm.vec3.new( 1, 1, 1 ) local position = self.shape:getWorldPosition() self.myArea = sm.areaTrigger.createBox( size, position ) self.myArea:bindOnEnter( "onEnter" ) end function MyClass.onEnter( self, trigger, results ) for i, object in ipairs( results ) do print( object, "just entered" ) end end
Example with a filter:
function MyClass.server_onCreate( self ) local size = sm.vec3.new( 10, 10, 5 ) local position = sm.vec3.new( 50, 40, 30 ) -- Only detect characters local filter = sm.areaTrigger.filter.character self.myArea = sm.areaTrigger.createBox( size, position, filter ) self.myArea:bindOnStay( "onStay" ) end -- Callback receives a list of characters function MyClass.onStay( self, trigger, results ) if #results > 0 then print( "Intruder alert!" ) end end
Constants:
Functions:
sm.areaTrigger.areaTriggerProxyType table
Defines special area trigger features:
- default – Nothing special.
- water – Buoyancy applied to colliding objects.
- interactable – Can be interacted with if implementing bindCanInteract, bindOnInteract, bindCanErase and bindOnDestroy.
- ladder – Attach colliding players to the trigger.
- melee – Can react to melee attack callbacks if implementing bindOnMelee.
| default | 0 |
| water | 1 |
| interactable | 2 |
| ladder | 3 |
sm.areaTrigger.filter table
Filters are used to specify what object types an area trigger is able to detect. If an area trigger is created with a filter, it will only react to objects of that type. Filters can be combined by adding them.
The filters are:
- dynamicBody – Detects bodies that are free to move around in the world.
- staticBody – Detects bodies that are built on the ground or on the lift.
- character – Detects characters such as players.
- areatrigger – Detects areatriggers such as water areas.
- harvestable – Detects harvestables such as planted objects.
- lift – Detects lifts.
- voxelTerrain – Detects destructible terrain.
- all – Detects all of the object types above. (Default)
| dynamicBody | 1 |
| staticBody | 2 |
| character | 4 |
| areatrigger | 8 |
| harvestable | 512 |
| lift | 1024 |
| voxelTerrain | 32768 |
| all | 34319 |
sm.areaTrigger.liquidType table
Defines the liquid type of an area trigger.
Only has an effect on area triggers with the water proxy type; setting it on any other proxy type has no effect.
Currently only lava has special behavior.
- water – Water. The default. No special behavior beyond the water proxy buoyancy.
- chemical – Chemical. No special behavior beyond the water proxy buoyancy.
- oil – Oil. No special behavior beyond the water proxy buoyancy.
- lava – Lava. Occasionally destroys submerged shapes. Requires AreaTrigger: setIncludeShapesInContent.
sm.areaTrigger.createAttachedBox(character, dimension, position?, rotation?, filter?, userdata?, areaTriggerProxyType?, boneName?)
Creates an area trigger box with a given size that stays attached to an character
If a filter is specified, the trigger area will only be able to detects objects of that certain type. See sm.areaTrigger.filter for more information about filters.
Parameters:
| Type | Name | Description |
|---|---|---|
| Character | character | The host character. |
| Vec3 | dimension | The size of the box |
| Vec3 | position? | The position offset (Defaults to sm.vec3.zero) |
| Quat | rotation? | The rotation offset (Defaults to sm.quat.identity) |
| integer | filter? | The object types the area trigger may detect. (See sm.areaTrigger.filter). (Defaults to sm.areaTrigger.filter.all) |
| table | userdata? | An optional table of user data |
| integer | areaTriggerProxyType? | The proxy type of the area trigger. (See sm.areaTrigger.areaTriggerProxyType) (Defaults to sm.areaTrigger.areaTriggerProxyType.default) |
| string | boneName? | The bone name of the character to attach the area trigger to. (optional) |
Returns:
| Type | Description |
|---|---|
| AreaTrigger | The created area trigger. |
sm.areaTrigger.createAttachedBox(harvestable, dimension, position?, rotation?, filter?, userdata?, areaTriggerProxyType?)
Creates an area trigger box with a given size that stays attached to an harvestable
If a filter is specified, the trigger area will only be able to detects objects of that certain type. See sm.areaTrigger.filter for more information about filters.
Parameters:
| Type | Name | Description |
|---|---|---|
| Harvestable | harvestable | The host harvestable. |
| Vec3 | dimension | The size of the box |
| Vec3 | position? | The position offset (Defaults to sm.vec3.zero) |
| Quat | rotation? | The rotation offset (Defaults to sm.quat.identity) |
| integer | filter? | The object types the area trigger may detect. (See sm.areaTrigger.filter). (Defaults to sm.areaTrigger.filter.all) |
| table | userdata? | An optional table of user data |
| integer | areaTriggerProxyType? | The proxy type of the area trigger. (See sm.areaTrigger.areaTriggerProxyType) (Defaults to sm.areaTrigger.areaTriggerProxyType.default) |
Returns:
| Type | Description |
|---|---|
| AreaTrigger | The created area trigger. |
sm.areaTrigger.createAttachedBox(shape, dimension, position?, rotation?, filter?, userdata?, areaTriggerProxyType?, boneName?)
Creates an area trigger box with a given size that stays attached to an shape
If a filter is specified, the trigger area will only be able to detects objects of that certain type. See sm.areaTrigger.filter for more information about filters.
Parameters:
| Type | Name | Description |
|---|---|---|
| Shape | shape | The host shape |
| Vec3 | dimension | The size of the box |
| Vec3 | position? | The position offset (Defaults to sm.vec3.zero) |
| Quat | rotation? | The rotation offset (Defaults to sm.quat.identity) |
| integer | filter? | The object types the area trigger may detect. (See sm.areaTrigger.filter). (Defaults to sm.areaTrigger.filter.all) |
| table | userdata? | An optional table of user data |
| integer | areaTriggerProxyType? | The proxy type of the area trigger. (See sm.areaTrigger.areaTriggerProxyType) (Defaults to sm.areaTrigger.areaTriggerProxyType.default) |
| string | boneName? | The bone name of the shape to attach the area trigger to. (optional) |
Returns:
| Type | Description |
|---|---|
| AreaTrigger | The created area trigger. |
sm.areaTrigger.createAttachedBox(interactable, dimension, position?, rotation?, filter?, userdata?, areaTriggerProxyType?, boneName?)
Creates an area trigger box with a given size that stays attached to an interactable
If a filter is specified, the trigger area will only be able to detects objects of that certain type. See sm.areaTrigger.filter for more information about filters.
Parameters:
| Type | Name | Description |
|---|---|---|
| Interactable | interactable | The host interactable |
| Vec3 | dimension | The size of the box |
| Vec3 | position? | The position offset (Defaults to sm.vec3.zero) |
| Quat | rotation? | The rotation offset (Defaults to sm.quat.identity) |
| integer | filter? | The object types the area trigger may detect. (See sm.areaTrigger.filter). (Defaults to sm.areaTrigger.filter.all) |
| table | userdata? | An optional table of user data |
| integer | areaTriggerProxyType? | The proxy type of the area trigger. (See sm.areaTrigger.areaTriggerProxyType) (Defaults to sm.areaTrigger.areaTriggerProxyType.default) |
| string | boneName? | The bone name of the interactable to attach the area trigger to. (optional) |
Returns:
| Type | Description |
|---|---|
| AreaTrigger | The created area trigger. |
sm.areaTrigger.createAttachedCylinder(character, radius, halfLength, position?, rotation?, filter?, userdata?, areaTriggerProxyType?, boneName?)
Creates an area trigger cylinder with a given size that stays attached to a character
If a filter is specified, the trigger area will only be able to detects objects of that certain type. See sm.areaTrigger.filter for more information about filters.
Parameters:
| Type | Name | Description |
|---|---|---|
| Character | character | The host character. |
| number | radius | The radius of the cylinder. |
| number | halfLength | The lengthwise extent of the cylinder (i.e. half the length of the cylinder). |
| Vec3 | position? | The position offset (Defaults to sm.vec3.zero) |
| Quat | rotation? | The rotation offset (Defaults to sm.quat.identity) |
| integer | filter? | The object types the area trigger may detect. (See sm.areaTrigger.filter). (Defaults to sm.areaTrigger.filter.all) |
| table | userdata? | An optional table of user data |
| integer | areaTriggerProxyType? | The proxy type of the area trigger. (See sm.areaTrigger.areaTriggerProxyType) (Defaults to sm.areaTrigger.areaTriggerProxyType.default) |
| string | boneName? | The bone name of the character to attach the area trigger to. (optional) |
Returns:
| Type | Description |
|---|---|
| AreaTrigger | The created area trigger. |
sm.areaTrigger.createAttachedCylinder(harvestable, radius, halfLength, position?, rotation?, filter?, userdata?, areaTriggerProxyType?)
Creates an area trigger cylinder with a given size that stays attached to an harvestable
If a filter is specified, the trigger area will only be able to detects objects of that certain type. See sm.areaTrigger.filter for more information about filters.
Parameters:
| Type | Name | Description |
|---|---|---|
| Harvestable | harvestable | The host harvestable. |
| number | radius | The radius of the cylinder. |
| number | halfLength | The lengthwise extent of the cylinder (i.e. half the length of the cylinder). |
| Vec3 | position? | The position offset (Defaults to sm.vec3.zero) |
| Quat | rotation? | The rotation offset (Defaults to sm.quat.identity) |
| integer | filter? | The object types the area trigger may detect. (See sm.areaTrigger.filter). (Defaults to sm.areaTrigger.filter.all) |
| table | userdata? | An optional table of user data |
| integer | areaTriggerProxyType? | The proxy type of the area trigger. (See sm.areaTrigger.areaTriggerProxyType) (Defaults to sm.areaTrigger.areaTriggerProxyType.default) |
Returns:
| Type | Description |
|---|---|
| AreaTrigger | The created area trigger. |
sm.areaTrigger.createAttachedCylinder(shape, radius, halfLength, position?, rotation?, filter?, userdata?, areaTriggerProxyType?, boneName?)
Creates an area trigger cylinder with a given size that stays attached to an shape
If a filter is specified, the trigger area will only be able to detects objects of that certain type. See sm.areaTrigger.filter for more information about filters.
Parameters:
| Type | Name | Description |
|---|---|---|
| Shape | shape | The host shape |
| number | radius | The radius of the cylinder. |
| number | halfLength | The lengthwise extent of the cylinder (i.e. half the length of the cylinder). |
| Vec3 | position? | The position offset (Defaults to sm.vec3.zero) |
| Quat | rotation? | The rotation offset (Defaults to sm.quat.identity) |
| integer | filter? | The object types the area trigger may detect. (See sm.areaTrigger.filter). (Defaults to sm.areaTrigger.filter.all) |
| table | userdata? | An optional table of user data |
| integer | areaTriggerProxyType? | The proxy type of the area trigger. (See sm.areaTrigger.areaTriggerProxyType) (Defaults to sm.areaTrigger.areaTriggerProxyType.default) |
| string | boneName? | The bone name of the shape to attach the area trigger to. (optional) |
Returns:
| Type | Description |
|---|---|
| AreaTrigger | The created area trigger. |
sm.areaTrigger.createAttachedCylinder(interactable, radius, halfLength, position?, rotation?, filter?, userdata?, areaTriggerProxyType?, boneName?)
Creates an area trigger cylinder with a given size that stays attached to an interactable
If a filter is specified, the trigger area will only be able to detects objects of that certain type. See sm.areaTrigger.filter for more information about filters.
Parameters:
| Type | Name | Description |
|---|---|---|
| Interactable | interactable | The host interactable |
| number | radius | The radius of the cylinder. |
| number | halfLength | The lengthwise extent of the cylinder (i.e. half the length of the cylinder). |
| Vec3 | position? | The position offset (Defaults to sm.vec3.zero) |
| Quat | rotation? | The rotation offset (Defaults to sm.quat.identity) |
| integer | filter? | The object types the area trigger may detect. (See sm.areaTrigger.filter). (Defaults to sm.areaTrigger.filter.all) |
| table | userdata? | An optional table of user data |
| integer | areaTriggerProxyType? | The proxy type of the area trigger. (See sm.areaTrigger.areaTriggerProxyType) (Defaults to sm.areaTrigger.areaTriggerProxyType.default) |
| string | boneName? | The bone name of the interactable to attach the area trigger to. (optional) |
Returns:
| Type | Description |
|---|---|
| AreaTrigger | The created area trigger. |
sm.areaTrigger.createAttachedHull(character, hull, position?, rotation?, filter?, userdata?, areaTriggerProxyType?, boneName?)
Creates an area trigger hull with a given size that stays attached to a character
If a filter is specified, the trigger area will only be able to detects objects of that certain type. See sm.areaTrigger.filter for more information about filters.
Parameters:
| Type | Name | Description |
|---|---|---|
| Character | character | The host character. |
| string | hull | The path to the hull file. |
| Vec3 | position? | The position offset (Defaults to sm.vec3.zero) |
| Quat | rotation? | The rotation offset (Defaults to sm.quat.identity) |
| integer | filter? | The object types the area trigger may detect. (See sm.areaTrigger.filter). (Defaults to sm.areaTrigger.filter.all) |
| table | userdata? | An optional table of user data |
| integer | areaTriggerProxyType? | The proxy type of the area trigger. (See sm.areaTrigger.areaTriggerProxyType) (Defaults to sm.areaTrigger.areaTriggerProxyType.default) |
| string | boneName? | The bone name of the character to attach the area trigger to. (optional) |
Returns:
| Type | Description |
|---|---|
| AreaTrigger | The created area trigger. |
sm.areaTrigger.createAttachedHull(harvestable, hull, position?, rotation?, filter?, userdata?, areaTriggerProxyType?)
Creates an area trigger hull with a given size that stays attached to an harvestable
If a filter is specified, the trigger area will only be able to detects objects of that certain type. See sm.areaTrigger.filter for more information about filters.
Parameters:
| Type | Name | Description |
|---|---|---|
| Harvestable | harvestable | The host harvestable. |
| string | hull | The path to the hull file. |
| Vec3 | position? | The position offset (Defaults to sm.vec3.zero) |
| Quat | rotation? | The rotation offset (Defaults to sm.quat.identity) |
| integer | filter? | The object types the area trigger may detect. (See sm.areaTrigger.filter). (Defaults to sm.areaTrigger.filter.all) |
| table | userdata? | An optional table of user data |
| integer | areaTriggerProxyType? | The proxy type of the area trigger. (See sm.areaTrigger.areaTriggerProxyType) (Defaults to sm.areaTrigger.areaTriggerProxyType.default) |
Returns:
| Type | Description |
|---|---|
| AreaTrigger | The created area trigger. |
sm.areaTrigger.createAttachedHull(shape, hull, position?, rotation?, filter?, userdata?, areaTriggerProxyType?, boneName?)
Creates an area trigger hull with a given size that stays attached to an shape
If a filter is specified, the trigger area will only be able to detects objects of that certain type. See sm.areaTrigger.filter for more information about filters.
Parameters:
| Type | Name | Description |
|---|---|---|
| Shape | shape | The host shape |
| string | hull | The path to the hull file. |
| Vec3 | position? | The position offset (Defaults to sm.vec3.zero) |
| Quat | rotation? | The rotation offset (Defaults to sm.quat.identity) |
| integer | filter? | The object types the area trigger may detect. (See sm.areaTrigger.filter). (Defaults to sm.areaTrigger.filter.all) |
| table | userdata? | An optional table of user data |
| integer | areaTriggerProxyType? | The proxy type of the area trigger. (See sm.areaTrigger.areaTriggerProxyType) (Defaults to sm.areaTrigger.areaTriggerProxyType.default) |
| string | boneName? | The bone name of the shape to attach the area trigger to. (optional) |
Returns:
| Type | Description |
|---|---|
| AreaTrigger | The created area trigger. |
sm.areaTrigger.createAttachedHull(interactable, hull, position?, rotation?, filter?, userdata?, areaTriggerProxyType?, boneName?)
Creates an area trigger hull with a given size that stays attached to an interactable
If a filter is specified, the trigger area will only be able to detects objects of that certain type. See sm.areaTrigger.filter for more information about filters.
Parameters:
| Type | Name | Description |
|---|---|---|
| Interactable | interactable | The host interactable |
| string | hull | The path to the hull file. |
| Vec3 | position? | The position offset (Defaults to sm.vec3.zero) |
| Quat | rotation? | The rotation offset (Defaults to sm.quat.identity) |
| integer | filter? | The object types the area trigger may detect. (See sm.areaTrigger.filter). (Defaults to sm.areaTrigger.filter.all) |
| table | userdata? | An optional table of user data |
| integer | areaTriggerProxyType? | The proxy type of the area trigger. (See sm.areaTrigger.areaTriggerProxyType) (Defaults to sm.areaTrigger.areaTriggerProxyType.default) |
| string | boneName? | The bone name of the interactable to attach the area trigger to. (optional) |
Returns:
| Type | Description |
|---|---|
| AreaTrigger | The created area trigger. |
sm.areaTrigger.createAttachedSphere(character, radius, position?, rotation?, filter?, userdata?, areaTriggerProxyType?, boneName?)
Creates an area trigger sphere with a given size that stays attached to a character
If a filter is specified, the trigger area will only be able to detects objects of that certain type. See sm.areaTrigger.filter for more information about filters.
Parameters:
| Type | Name | Description |
|---|---|---|
| Character | character | The host character. |
| number | radius | The radius of the sphere. |
| Vec3 | position? | The position offset (Defaults to sm.vec3.zero) |
| Quat | rotation? | The rotation offset (Defaults to sm.quat.identity) |
| integer | filter? | The object types the area trigger may detect. (See sm.areaTrigger.filter). (Defaults to sm.areaTrigger.filter.all) |
| table | userdata? | An optional table of user data |
| integer | areaTriggerProxyType? | The proxy type of the area trigger. (See sm.areaTrigger.areaTriggerProxyType) (Defaults to sm.areaTrigger.areaTriggerProxyType.default) |
| string | boneName? | The bone name of the character to attach the area trigger to. (optional) |
Returns:
| Type | Description |
|---|---|
| AreaTrigger | The created area trigger. |
sm.areaTrigger.createAttachedSphere(harvestable, radius, position?, rotation?, filter?, userdata?, areaTriggerProxyType?)
Creates an area trigger sphere with a given size that stays attached to an harvestable
If a filter is specified, the trigger area will only be able to detects objects of that certain type. See sm.areaTrigger.filter for more information about filters.
Parameters:
| Type | Name | Description |
|---|---|---|
| Harvestable | harvestable | The host harvestable. |
| number | radius | The radius of the sphere. |
| Vec3 | position? | The position offset (Defaults to sm.vec3.zero) |
| Quat | rotation? | The rotation offset (Defaults to sm.quat.identity) |
| integer | filter? | The object types the area trigger may detect. (See sm.areaTrigger.filter). (Defaults to sm.areaTrigger.filter.all) |
| table | userdata? | An optional table of user data |
| integer | areaTriggerProxyType? | The proxy type of the area trigger. (See sm.areaTrigger.areaTriggerProxyType) (Defaults to sm.areaTrigger.areaTriggerProxyType.default) |
Returns:
| Type | Description |
|---|---|
| AreaTrigger | The created area trigger. |
sm.areaTrigger.createAttachedSphere(shape, radius, position?, rotation?, filter?, userdata?, areaTriggerProxyType?, boneName?)
Creates an area trigger sphere with a given size that stays attached to an shape
If a filter is specified, the trigger area will only be able to detects objects of that certain type. See sm.areaTrigger.filter for more information about filters.
Parameters:
| Type | Name | Description |
|---|---|---|
| Shape | shape | The host shape |
| number | radius | The radius of the sphere. |
| Vec3 | position? | The position offset (Defaults to sm.vec3.zero) |
| Quat | rotation? | The rotation offset (Defaults to sm.quat.identity) |
| integer | filter? | The object types the area trigger may detect. (See sm.areaTrigger.filter). (Defaults to sm.areaTrigger.filter.all) |
| table | userdata? | An optional table of user data |
| integer | areaTriggerProxyType? | The proxy type of the area trigger. (See sm.areaTrigger.areaTriggerProxyType) (Defaults to sm.areaTrigger.areaTriggerProxyType.default) |
| string | boneName? | The bone name of the shape to attach the area trigger to. (optional) |
Returns:
| Type | Description |
|---|---|
| AreaTrigger | The created area trigger. |
sm.areaTrigger.createAttachedSphere(interactable, radius, position?, rotation?, filter?, userdata?, areaTriggerProxyType?, boneName?)
Creates an area trigger sphere with a given size that stays attached to an interactable
If a filter is specified, the trigger area will only be able to detects objects of that certain type. See sm.areaTrigger.filter for more information about filters.
Parameters:
| Type | Name | Description |
|---|---|---|
| Interactable | interactable | The host interactable |
| number | radius | The radius of the sphere. |
| Vec3 | position? | The position offset (Defaults to sm.vec3.zero) |
| Quat | rotation? | The rotation offset (Defaults to sm.quat.identity) |
| integer | filter? | The object types the area trigger may detect. (See sm.areaTrigger.filter). (Defaults to sm.areaTrigger.filter.all) |
| table | userdata? | An optional table of user data |
| integer | areaTriggerProxyType? | The proxy type of the area trigger. (See sm.areaTrigger.areaTriggerProxyType) (Defaults to sm.areaTrigger.areaTriggerProxyType.default) |
| string | boneName? | The bone name of the interactable to attach the area trigger to. (optional) |
Returns:
| Type | Description |
|---|---|
| AreaTrigger | The created area trigger. |
sm.areaTrigger.createBox(dimension, position, rotation?, filter?, userdata?, world?, areaTriggerProxyType?)
Creates a new box area trigger at a given position with a given size.
If a filter is specified, the trigger area will only be able to detects objects of that certain type. See sm.areaTrigger.filter for more information about filters.
Parameters:
| Type | Name | Description |
|---|---|---|
| Vec3 | dimension | The dimensions of the box. |
| Vec3 | position | The world position. |
| Quat | rotation? | The world rotation. (Defaults to sm.quat.identity) |
| integer | filter? | The object types the area trigger may detect. (See sm.areaTrigger.filter). (Defaults to sm.areaTrigger.filter.all) |
| table | userdata? | An optional table of user data |
| World | world? | The world to create the area trigger in. (optional) |
| integer | areaTriggerProxyType? | The proxy type of the area trigger. (See sm.areaTrigger.areaTriggerProxyType) (Defaults to sm.areaTrigger.areaTriggerProxyType.default) |
Returns:
| Type | Description |
|---|---|
| AreaTrigger | The created area trigger. |
sm.areaTrigger.createBoxWater(dimension, position, rotation?, filter?, userdata?)
Deprecated:
use sm.areaTrigger.createBox with sm.areaTrigger.areaTriggerProxyType instead.
Creates a new box area trigger that represent water ie. certain objects cant be placed in it.
If a filter is specified, the trigger area will only be able to detects objects of that certain type. See sm.areaTrigger.filter for more information about filters.
Parameters:
| Type | Name | Description |
|---|---|---|
| Vec3 | dimension | The dimensions of the box. |
| Vec3 | position | The world position. |
| Quat | rotation? | The world rotation. (Defaults to sm.quat.identity) |
| integer | filter? | The object types the area trigger may detect. (See sm.areaTrigger.filter). (Defaults to sm.areaTrigger.filter.all) |
| table | userdata? | An optional table of user data |
Returns:
| Type | Description |
|---|---|
| AreaTrigger | The created area trigger. |
sm.areaTrigger.createCylinder(radius, halfLength, position, rotation?, filter?, userdata?, world?, areaTriggerProxyType?)
Creates a new cylinder area trigger at a given position with a given size.
If a filter is specified, the trigger area will only be able to detects objects of that certain type. See sm.areaTrigger.filter for more information about filters.
Parameters:
| Type | Name | Description |
|---|---|---|
| number | radius | The radius of the cylinder. |
| number | halfLength | The lengthwise extent of the cylinder (i.e. half the length of the cylinder). |
| Vec3 | position | The world position. |
| Quat | rotation? | The world rotation. (Defaults to sm.quat.identity) |
| integer | filter? | The object types the area trigger may detect. (See sm.areaTrigger.filter). (Defaults to sm.areaTrigger.filter.all) |
| table | userdata? | An optional table of user data |
| World | world? | The world to create the area trigger in. (optional) |
| integer | areaTriggerProxyType? | The proxy type of the area trigger. (See sm.areaTrigger.areaTriggerProxyType) (Defaults to sm.areaTrigger.areaTriggerProxyType.default) |
Returns:
| Type | Description |
|---|---|
| AreaTrigger | The created area trigger. |
sm.areaTrigger.createHull(hull, position, rotation?, filter?, userdata?, world?, areaTriggerProxyType?)
Creates a new hull area trigger at a given position with a given size.
If a filter is specified, the trigger area will only be able to detects objects of that certain type. See sm.areaTrigger.filter for more information about filters.
Parameters:
| Type | Name | Description |
|---|---|---|
| string | hull | The path to the hull file. |
| Vec3 | position | The world position. |
| Quat | rotation? | The world rotation. (Defaults to sm.quat.identity) |
| integer | filter? | The object types the area trigger may detect. (See sm.areaTrigger.filter). (Defaults to sm.areaTrigger.filter.all) |
| table | userdata? | An optional table of user data |
| World | world? | The world to create the area trigger in. (optional) |
| integer | areaTriggerProxyType? | The proxy type of the area trigger. (See sm.areaTrigger.areaTriggerProxyType) (Defaults to sm.areaTrigger.areaTriggerProxyType.default) |
Returns:
| Type | Description |
|---|---|
| AreaTrigger | The created area trigger. |
sm.areaTrigger.createSphere(radius, position, rotation?, filter?, userdata?, world?, areaTriggerProxyType?)
Creates a new sphere area trigger at a given position with a given size.
If a filter is specified, the trigger area will only be able to detects objects of that certain type. See sm.areaTrigger.filter for more information about filters.
Parameters:
| Type | Name | Description |
|---|---|---|
| number | radius | The radius of the sphere. |
| Vec3 | position | The world position. |
| Quat | rotation? | The world rotation. (Defaults to sm.quat.identity) |
| integer | filter? | The object types the area trigger may detect. (See sm.areaTrigger.filter). (Defaults to sm.areaTrigger.filter.all) |
| table | userdata? | An optional table of user data |
| World | world? | The world to create the area trigger in. (optional) |
| integer | areaTriggerProxyType? | The proxy type of the area trigger. (See sm.areaTrigger.areaTriggerProxyType) (Defaults to sm.areaTrigger.areaTriggerProxyType.default) |
Returns:
| Type | Description |
|---|---|
| AreaTrigger | The created area trigger. |