Ir para o conteúdo principal
Version: latest - a1.73.x ⚖️

Base Actor

An Actor is an object which can be spawned and destroyed through Lua.
Actors support 3D transformations such as translation (location), rotation, and scale.

An Actor is the base for several entities, and all those entities share the same Methods and Events described in this page.

🧑‍💻API Source
This page is auto-generated! The Functions, Properties and Events described here are defined in our GitHub's API Repository! Feel free to commit suggestions and changes to the source .json API files!
👪Base Class
This is a Base Class. Base Classes are abstract definitions used to share common methods and events between related child classes, thus you cannot spawn it directly.

Classes that share methods and events from this Base Class: Billboard, Blueprint, Cable, Character, CharacterSimple, Decal, Gizmo, Grenade, Light, Melee, Particle, Prop, SceneCapture, StaticMesh, Sound, TextRender, Trigger, VehicleWheeled, VehicleWater, Weapon, Widget3D.

🗿 Static Functions

This class doesn't have own static functions.

🦠 Functions

caution

Some of the following methods may not work on certain Actor classes.

ReturnsNameDescription
Adds an Unreal Actor Tag to this Actor
Applies a force in world world to this Actor
Attaches this Actor to any other Actor, optionally at a specific bone
Detaches this Actor from AttachedTo Actor
of Gets all Unreal Actor Tags on this Actor
of Gets all Actors attached to this Actor
or Gets the Actor this Actor is attached to
Gets this Actor's bounds
Gets this Actor's collision type
Gets this Actor's dimension
Gets the distance of this Actor from the Camera
VectorGets this Actor's force (set by SetForce())
VectorGets this Actor's location in the game world
Player or Gets this Actor's Network Authority Player
VectorGets this Actor's Relative Location if it's attached
RotatorGets this Actor's Relative Rotation if it's attached
RotatorGets this Actor's angle in the game world
VectorGets this Actor's scale
Gets the percentage of this Actor size in the screen
Gets a Socket Transform in world space given a bone or socket name
VectorGets this Actor's current velocity
Gets if this Actor was spawned by the client side
Returns true if the local Player is currently the Network Authority of this Actor
Returns true if this Actor is being destroyed
Returns true if gravity is enabled on this Actor
Returns true if this Actor is in water
Returns true if this Actor is currently network distributed
Returns true if this Actor is visible
Removes an Unreal Actor Tag from this Actor
Smoothly rotates this actor to an angle over a certain time
Sets this Actor's collision type
Sets this Actor's Dimension
Adds a permanent force to this Actor, set to Vector(0, 0, 0) to cancel
Sets whether gravity is enabled on this Actor
Sets whether the highlight is enabled on this Actor, and which highlight index to use
Sets the time (in seconds) before this Actor is destroyed. After this time has passed, the actor will be automatically destroyed.
Sets this Actor's location in the game world
Sets the Player to have network authority over this Actor
Sets if this Actor will auto distribute the network authority between players
Sets whether the outline is enabled on this Actor, and which outline index to use
Sets this Actor's relative location in local space (only if this actor is attached)
Sets this Actor's relative rotation in local space (only if this actor is attached)
Sets this Actor's rotation in the game world
Sets this Actor's scale
Sets whether the actor is visible or not
Smoothly moves this actor to a location over a certain time
Gets if this Actor was recently rendered on screen

AddActorTag

Adds an Unreal Actor Tag to this Actor

my_actor:AddActorTag(tag)
TypeParameterDefaultDescription
tag Required parameter No description provided

See also RemoveActorTag, GetActorTags.


AddImpulse

Applies a force in world world to this Actor (the force is applied client side, by, in most cases, the player closest to this Actor)

my_actor:AddImpulse(force, velocity_change?)
TypeParameterDefaultDescription
Vectorforce Required parameter No description provided
velocity_change?falseWhether to ignore mass

AttachTo

Attaches this Actor to any other Actor, optionally at a specific bone

my_actor:AttachTo(other, attachment_rule?, bone_name?, lifespan_when_detached?, use_absolute_rotation?)
TypeParameterDefaultDescription
other Required parameter Other actor to attach
attachment_rule?SnapToTargetHow to attach
bone_name?Which bone to attach to. If empty it will be attached to the Actor, otherwise to the Mesh at the bone/socket
lifespan_when_detached?-1Seconds before destroying this Actor when detached, setting it to 0 will automatically destroy this actor when detached, setting it to 10 will destroy this after 10 seconds when detached
use_absolute_rotation?falseWhether to force attached object to use absolute rotation (will not follow parent)

Detach

Detaches this Actor from AttachedTo Actor

my_actor:Detach()

GetActorTags

Gets all Unreal Actor Tags on this Actor

— Returns of .

local ret = my_actor:GetActorTags()

See also AddActorTag, RemoveActorTag.


GetAttachedEntities

Gets all Actors attached to this Actor

— Returns of .

local ret = my_actor:GetAttachedEntities()

GetAttachedTo

Gets the Actor this Actor is attached to

— Returns or .

local ret = my_actor:GetAttachedTo()

GetBounds

Gets this Actor's bounds

— Returns ().

local ret = my_actor:GetBounds()

GetCollision

Gets this Actor's collision type

— Returns .

local ret = my_actor:GetCollision()

See also SetCollision.


GetDimension

Gets this Actor's dimension

— Returns .

local ret = my_actor:GetDimension()

See also SetDimension, DimensionChange.


GetDistanceFromCamera

Gets the distance of this Actor from the Camera

— Returns .

local ret = my_actor:GetDistanceFromCamera()

GetForce

Gets this Actor's force (set by SetForce())

— Returns Vector.

local ret = my_actor:GetForce()

See also SetForce.


GetLocation

Gets this Actor's location in the game world

— Returns Vector.

local ret = my_actor:GetLocation()

See also SetLocation.


GetNetworkAuthority

Gets this Actor's Network Authority Player

— Returns Player or .

local ret = my_actor:GetNetworkAuthority()

See also SetNetworkAuthority.


GetRelativeLocation

Gets this Actor's Relative Location if it's attached

— Returns Vector.

local ret = my_actor:GetRelativeLocation()

See also SetRelativeLocation.


GetRelativeRotation

Gets this Actor's Relative Rotation if it's attached

— Returns Rotator.

local ret = my_actor:GetRelativeRotation()

See also SetRelativeRotation.


GetRotation

Gets this Actor's angle in the game world

— Returns Rotator.

local ret = my_actor:GetRotation()

See also SetRotation.


GetScale

Gets this Actor's scale

— Returns Vector.

local ret = my_actor:GetScale()

See also SetScale.


GetScreenPercentage

Gets the percentage of this Actor size in the screen

— Returns .

local ret = my_actor:GetScreenPercentage()

GetSocketTransform

Gets a Socket Transform in world space given a bone or socket name

— Returns ().

local ret = my_actor:GetSocketTransform(socket_name)
TypeParameterDefaultDescription
socket_name Required parameter No description provided

GetVelocity

Gets this Actor's current velocity

— Returns Vector.

local ret = my_actor:GetVelocity()

HasAuthority

Gets if this Actor was spawned by the client side

— Returns (false if it was spawned by the Server or true if it was spawned by the client).

local ret = my_actor:HasAuthority()

HasNetworkAuthority

Returns true if the local Player is currently the Network Authority of this Actor

— Returns .

local ret = my_actor:HasNetworkAuthority()

IsBeingDestroyed

Returns true if this Actor is being destroyed.
You can check this inside events like Drop to see if a Pickable is being dropped because it's going to be destroyed

— Returns .

local ret = my_actor:IsBeingDestroyed()

IsGravityEnabled

Returns true if gravity is enabled on this Actor

— Returns .

local ret = my_actor:IsGravityEnabled()

See also SetGravityEnabled.


IsInWater

Returns true if this Actor is in water

— Returns .

local ret = my_actor:IsInWater()

IsNetworkDistributed

Returns true if this Actor is currently network distributed. Only actors being network distributed can have their network authority set
Entities have NetworkDistributed automatically disabled when: Attached, Possessed, Grabbed, Picked Up or Driving

— Returns .

local ret = my_actor:IsNetworkDistributed()

IsVisible

Returns true if this Actor is visible

— Returns .

local ret = my_actor:IsVisible()

RemoveActorTag

Removes an Unreal Actor Tag from this Actor

my_actor:RemoveActorTag(tag)
TypeParameterDefaultDescription
tag Required parameter No description provided

See also AddActorTag, GetActorTags.


RotateTo

Smoothly rotates this actor to an angle over a certain time

my_actor:RotateTo(rotation, time, exp?)
TypeParameterDefaultDescription
Rotatorrotation Required parameter No description provided
time Required parameter Time to interpolate from current location to target location
exp?0Exponent used to smooth interpolation. Use 0 for linear movement

SetCollision

Sets this Actor's collision type

my_actor:SetCollision(collision_type)
TypeParameterDefaultDescription
collision_type Required parameter No description provided

See also GetCollision.


SetDimension

Sets this Actor's Dimension

my_actor:SetDimension(dimension)
TypeParameterDefaultDescription
dimension Required parameter No description provided

See also GetDimension, DimensionChange.


SetForce

Adds a permanent force to this Actor, set to Vector(0, 0, 0) to cancel

my_actor:SetForce(force, is_local?)
TypeParameterDefaultDescription
Vectorforce Required parameter No description provided
is_local?trueWhether to apply the force in local space

See also GetForce.


SetGravityEnabled

Sets whether gravity is enabled on this Actor

my_actor:SetGravityEnabled(gravity_enabled)
TypeParameterDefaultDescription
gravity_enabled Required parameter No description provided

See also IsGravityEnabled.


SetHighlightEnabled

Sets whether the highlight is enabled on this Actor, and which highlight index to use. This will apply the highlight on every attached entity too

my_actor:SetHighlightEnabled(is_enabled, index?)
TypeParameterDefaultDescription
is_enabled Required parameter No description provided
index?0Index to use (should be 0, 1 or 2)

See also Client.SetHighlightColor().


SetLifeSpan

Sets the time (in seconds) before this Actor is destroyed. After this time has passed, the actor will be automatically destroyed.

my_actor:SetLifeSpan(seconds)
TypeParameterDefaultDescription
seconds Required parameter Seconds before being destroyed

SetLocation

Sets this Actor's location in the game world

my_actor:SetLocation(location)
TypeParameterDefaultDescription
Vectorlocation Required parameter No description provided

See also GetLocation.


SetNetworkAuthority

Sets the Player to have network authority over this Actor. This Player will be manually assigned to handle this Actor's physics and share its location with other clients. The authority assignment will still be overridden by the game automatically

Please refer to Network Authority for more information

my_actor:SetNetworkAuthority(player?)
TypeParameterDefaultDescription
Playerplayer?nilNew player which will assume the Network Authority of this Actor

See also GetNetworkAuthority.


SetNetworkAuthorityAutoDistributed

Sets if this Actor will auto distribute the network authority between players when idle

Please refer to Network Authority for more information

my_actor:SetNetworkAuthorityAutoDistributed(auto_distribute)
TypeParameterDefaultDescription
auto_distribute Required parameter If this Actor will be auto network distributed

SetOutlineEnabled

Sets whether the outline is enabled on this Actor, and which outline index to use. This will apply the outline on every attached entity too

my_actor:SetOutlineEnabled(is_enabled, index?)
TypeParameterDefaultDescription
is_enabled Required parameter No description provided
index?0Index to use (should be 0, 1 or 2)

See also Client.SetOutlineColor().


SetRelativeLocation

Sets this Actor's relative location in local space (only if this actor is attached)

my_actor:SetRelativeLocation(relative_location)
TypeParameterDefaultDescription
Vectorrelative_location Required parameter No description provided

See also GetRelativeLocation.


SetRelativeRotation

Sets this Actor's relative rotation in local space (only if this actor is attached)

my_actor:SetRelativeRotation(relative_rotation)
TypeParameterDefaultDescription
Rotatorrelative_rotation Required parameter No description provided

See also GetRelativeRotation.


SetRotation

Sets this Actor's rotation in the game world

my_actor:SetRotation(rotation)
TypeParameterDefaultDescription
Rotatorrotation Required parameter No description provided

See also GetRotation.


SetScale

Sets this Actor's scale

my_actor:SetScale(scale)
TypeParameterDefaultDescription
Vectorscale Required parameter No description provided

See also GetScale.


SetVisibility

Sets whether the actor is visible or not

my_actor:SetVisibility(is_visible)
TypeParameterDefaultDescription
is_visible Required parameter No description provided

TranslateTo

Smoothly moves this actor to a location over a certain time

my_actor:TranslateTo(location, time, exp?)
TypeParameterDefaultDescription
Vectorlocation Required parameter No description provided
time Required parameter Time to interpolate from current location to target location
exp?0Exponent used to smooth interpolation. Use 0 for linear movement

WasRecentlyRendered

Gets if this Actor was recently rendered on screen

— Returns .

local ret = my_actor:WasRecentlyRendered()

🚀 Events

NameDescription
Triggered when an Actor changes it's dimension

DimensionChange

Triggered when an Actor changes it's dimension
Actor.Subscribe("DimensionChange", function(self, old_dimension, new_dimension)
-- DimensionChange was called
end)
TypeArgumentDescription
selfNo description provided
old_dimensionNo description provided
new_dimensionNo description provided

See also SetDimension, GetDimension.