Actor - stingray.Actor object reference - Stingray Lua API Reference

stingray.Actor object reference

Description

Interface to a physics actor.

An actor is a rigid body living in the physics world.

The Lua Actor object will become invalid if the physics actor is destroyed. To prevent against using an invalid Actor, you can store an Actor in an ActorBox for access in future frames. The ActorBox will detect whether or not the corresponding physics actor has become destroyed since the Actor was stored in the box.

Functions

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

velocity :

stingray.Vector3

A delta angular velocity added to the actor's current velocity.

Returns
This function does not return any values.

This call, and all other calls that change velocity or add forces, only affect physical actors.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

impulse :

stingray.Vector3

The impulse added to the actor.

Returns
This function does not return any values.

This call, and all other calls that change velocity or add forces, only affect physical actors.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

impulse :

stingray.Vector3

The impulse added to actor.

pos :

stingray.Vector3

The position where the impulse is applied.

Returns
This function does not return any values.

The impulse is expressed as (mass * velocity) in three dimensions.

This call, and all other calls that change velocity or add forces, only affect physical actors.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

impulse :

stingray.Vector3

The rotational impulse that will be applied to the actor.

Returns
This function does not return any values.

This call, and all other calls that change velocity or add forces, only affect physical actors.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

velocity :

stingray.Vector3

The change in velocity that will be added to the actor's current velocity.

Returns
This function does not return any values.

This call, and all other calls that change velocity or add forces, only affect physical actors.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

velocity :

stingray.Vector3

The change in velocity that will be added to the actor's current velocity.

pos :

stingray.Vector3

The position at which the velocity is added.

Returns
This function does not return any values.

This call, and all other calls that change velocity or add forces, only affect physical actors.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

number

The angular damping of the actor.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

stingray.Vector3

The angular velocity of the actor.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

stingray.Vector3

The position of the actor's center of mass.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

boolean

Returns true if this actor can collide with other actors, or false otherwise.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

boolean

Returns true if the actor is dynamic, or false otherwise.

Non-static actors may be either kinematic/keyframed or physical (physics-driven).

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

boolean

Returns true if the actor is affected by gravity, or false otherwise.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

boolean

Returns true if the actor is kinematic, or false otherwise.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

boolean

Returns true if the actor is physical (physics-driven), or false otherwise.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

boolean

Returns true if this actor is included when performing scene queries.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

boolean

Returns true if the actor is sleeping, or false otherwise.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

boolean

Returns true if the actor is static, or false otherwise.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

number

The linear damping of the actor.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

number

The mass of the actor.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

integer

The index of the actor in the scene graph of its owning Unit.

Note that some actors may not have an owning Unit.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

p :

stingray.Vector3

A point on the surface of the actor.

Returns

stingray.Vector3

The velocity at the specified point on the surface of the actor.

The point is specified in global coordinates.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

stingray.Matrix4x4

The position and rotation of the actor.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

stingray.Vector3

The position of the actor.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

velocity :

stingray.Vector3

The velocity of the pushing object.

mass :

number

The mass of the pushing object.

Returns
This function does not return any values.

Use this to simulate a collision with objects that are not in the physics simulation, such as bullets.

This call, and all other calls that change velocity or add forces, only affect physical actors.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

velocity :

stingray.Vector3

The velocity of the pushing object.

mass :

number

The mass of the pushing object.

pos :

stingray.Vector3

The position where the actor is pushed.

Returns
This function does not return any values.

The force is applied at the specified position, causing the object to rotate.

This call, and all other calls that change velocity or add forces, only affect physical actors.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns
This function does not return any values.
Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

stingray.Quaternion

The rotation of the actor.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

damping :

number

The new angular damping value for the actor.

Returns
This function does not return any values.
Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

velocity :

stingray.Vector3

The new angular velocity to set for the actor.

Returns
This function does not return any values.

This call, and all other calls that change velocity or add forces, only affect physical actors.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

enabled :

boolean

true to enable collision, or false otherwise.

Returns
This function does not return any values.
Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

filter :

string

The new collision filter to set for the actor.

Returns
This function does not return any values.
Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

enabled :

boolean

true to make this actor subject to gravity, or false otherwise.

Returns
This function does not return any values.
Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

kinematic :

boolean

true to mark the actor as kinematic, or false otherwise.

Returns
This function does not return any values.

A kinematic actor will push dynamic actors, but won't slow down while doing so. Note that you can only use this on dynamic actors, not on static actors.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

damping :

number

The new linear damping value for the actor.

Returns
This function does not return any values.
Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

enabled :

boolean

true to enable scene queries for this actor, or false otherwise.

Returns
This function does not return any values.
Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

velocity :

stingray.Vector3

The new velocity to set for the actor.

Returns
This function does not return any values.

This call, and all other calls that change velocity or add forces, only affect physical actors.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

pos :

stingray.Matrix4x4

The new position and rotation to set for the actor.

Returns
This function does not return any values.

You should only call this function for dynamic actors. The position of static and keyframed actors is controlled by the position of the corresponding scene graph node.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

pos :

stingray.Vector3

The new position to set for the actor.

Returns
This function does not return any values.
Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

pos :

stingray.Quaternion

The new rotation to set for the actor.

Returns
This function does not return any values.
Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

stingray.Unit

The Unit that owns the actor, if any.

Note that some actors may not have an owning Unit.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns

stingray.Vector3

The velocity of the actor.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.
Returns
This function does not return any values.

Development only

The elements in this group are only available in development builds.

Do not use them in your final builds.

Parameters

self :

stingray.Actor

Specifies the object instance that this function will act on.

You must always provide this self parameter when you call this function. You must use the dot . calling syntax, not the object-oriented colon : calling syntax.For more information, see this Stingray help topic, or this page in the Lua documentation.

lineobject :

stingray.LineObject

The LineObject to use for representing this actor.

color :

stingray.Quaternion

The color used in the draw.

camera_tm :

stingray.Matrix4x4?

The position and rotation of the camera. This is used when drawing huge physics meshes and height fields: only the triangles close to the camera are drawn. If the camera pose is not specified, the engine uses World.debug_camera_pose().

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns
This function does not return any values.

Use this function only for debugging your development builds.