Skip to main content
Version: bleeding-edge ๐Ÿฉธ

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.

info

This is the base class for all Actors we have. You cannot spawn it directly.

๐Ÿ—ฟย Static Functionsโ€‹

This entity doesn't have own static functions.

๐Ÿฆ ย Functionsโ€‹

caution

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

ReturnsNameDescription
AddImpulseApplies a force in world world to this Actor
AttachToAttaches this Actor to any other Actor, optionally at a specific bone
DetachDetaches this Actor from AttachedTo Actor
SetCollisionSets this Actor's collision type
SetDimensionSets this Actor's Dimension
SetForceAdds a permanent force to this Actor, set to Vector(0, 0, 0) to cancel
SetGravityEnabledSets whether gravity is enabled on this Actor
SetVisibilitySets whether the actor is visible or not
SetHighlightEnabledSets whether the highlight is enabled on this Actor, and which highlight index to use
SetOutlineEnabledSets whether the outline is enabled on this Actor, and which outline index to use
SetLifeSpanSets the time (in seconds) before this Actor is destroyed. After this time has passed, the actor will be automatically destroyed.
SetLocationSets this Actor's location in the game world
SetRotationSets this Actor's rotation in the game world
SetRelativeLocationSets this Actor's relative location in local space (only if this actor is attached)
SetRelativeRotationSets this Actor's relative rotation in local space (only if this actor is attached)
SetScaleSets this Actor's scale
SetNetworkAuthoritySets the Player to have network authority over this Actor
SetNetworkAuthorityAutoDistributedSets if this Actor will auto distribute the network authority betwen players
TranslateToSmoothly moves this actor to a location over a certain time
RotateToSmoothly rotates this actor to an angle over a certain time
booleanIsBeingDestroyedReturns true if this Actor is being destroyed
booleanIsVisibleReturns true if this Actor is visible
booleanIsGravityEnabledReturns true if gravity is enabled on this Actor
booleanIsInWaterReturns true if this Actor is in water
booleanIsNetworkDistributedReturns true if this Actor is currently network distributed
table of Base ActorGetAttachedEntitiesGets all Actors attached to this Actor
Base Actor or nilGetAttachedToGets the Actor this Actor is attached to
tableGetBoundsGets this Actor's bounds
CollisionTypeGetCollisionGets this Actor's collision type
VectorGetLocationGets this Actor's location in the game world
VectorGetRelativeLocationGets this Actor's Relative Location if it's attached
Player or nilGetNetworkAuthorityGets this Actor's Network Authority Player
RotatorGetRotationGets this Actor's angle in the game world
RotatorGetRelativeRotationGets this Actor's Relative Rotation if it's attached
VectorGetForceGets this Actor's force (set by SetForce())
integerGetDimensionGets this Actor's dimension
booleanHasNetworkAuthorityReturns true if the local Player is currently the Network Authority of this Actor
booleanHasAuthorityGets if this Actor was spawned by the client side
VectorGetScaleGets this Actor's scale
VectorGetVelocityGets this Actor's current velocity
AddActorTagAdds an Unreal Actor Tag to this Actor
RemoveActorTagRemoves an Unreal Actor Tag from this Actor
table of stringGetActorTagsGets all Unreal Actor Tags on this Actor
booleanWasRecentlyRenderedGets if this Actor was recently rendered on screen
floatGetDistanceFromCameraGets the distance of this Actor from the Camera
floatGetScreenPercentageGets the percentage of this Actor size in the screen

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
booleanvelocity_change?falseWhether to ignore mass

AttachToโ€‹

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

  • AttachmentRule.KeepRelative will keep the current relative position/rotation if already attached.
  • AttachmentRule.KeepWorld will calculate the new relative position/rotation so the Actor stays at the same position after being attached.
  • AttachmentRule.SnapToTarget will set the Actor to the same position/rotation as other_actor (or at the bone location) and reset its relative position/rotation to zero.

Setting lifespan_when_detached to 0 will automatically destroy this actor when detached, setting it to 10 will destroy this after 10 seconds when detached.

my_actor:AttachTo(other, attachment_rule?, bone_name?, lifespan_when_detached?, use_absolute_rotation?)
TypeParameterDefaultDescription
Base ActorotherOther actor to attach
AttachmentRuleattachment_rule?SnapToTargetHow to attach
stringbone_name?Which bone to attach to
floatlifespan_when_detached?-1Seconds before destroying this Actor when detached
booleanuse_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()

SetCollisionโ€‹

Sets this Actor's collision type

my_actor:SetCollision(collision_type)
TypeParameterDefaultDescription
CollisionTypecollision_type

SetDimensionโ€‹

Sets this Actor's Dimension

my_actor:SetDimension(dimension)
TypeParameterDefaultDescription
integerdimension

See also 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
booleanis_local?trueWhether to apply the force in local space

SetGravityEnabledโ€‹

Sets whether gravity is enabled on this Actor

my_actor:SetGravityEnabled(is_enabled)
TypeParameterDefaultDescription
booleanis_enabled

SetVisibilityโ€‹

Sets whether the actor is visible or not

my_actor:SetVisibility(is_visible)
TypeParameterDefaultDescription
booleanis_visible

SetHighlightEnabledโ€‹

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

my_actor:SetHighlightEnabled(is_enabled, index?)
TypeParameterDefaultDescription
booleanis_enabled
integerindex?0Index to use (should be 0, 12)

See also Client.SetHighlightColor().


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
booleanis_enabled
integerindex?0Index to use (should be 0, 12)

See also Client.SetOutlineColor().


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
floatsecondsSeconds before being destroyed

SetLocationโ€‹

Sets this Actor's location in the game world

my_actor:SetLocation(location)
TypeParameterDefaultDescription
Vectorlocation

SetRotationโ€‹

Sets this Actor's rotation in the game world

my_actor:SetRotation(rotation)
TypeParameterDefaultDescription
Rotatorrotation

SetRelativeLocationโ€‹

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

my_actor:SetRelativeLocation(relative_location)
TypeParameterDefaultDescription
Vectorrelative_location

SetRelativeRotationโ€‹

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

my_actor:SetRelativeRotation(relative_rotation)
TypeParameterDefaultDescription
Rotatorrelative_rotation

SetScaleโ€‹

Sets this Actor's scale

my_actor:SetScale(scale)
TypeParameterDefaultDescription
Vectorscale

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

SetNetworkAuthorityAutoDistributedโ€‹

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

Please refer to Network Authority for more information

my_actor:SetNetworkAuthorityAutoDistributed(auto_distribute)
TypeParameterDefaultDescription
booleanauto_distributeIf this Actor will be auto network distributed

TranslateToโ€‹

Smoothly moves this actor to a location over a certain time

my_actor:TranslateTo(location, time, exp?)
TypeParameterDefaultDescription
Vectorlocation
floattimeTime to interpolate from current location to target location
floatexp?0Exponent used to smooth interpolation. Use 0 for linear movement

RotateToโ€‹

Smoothly rotates this actor to an angle over a certain time

my_actor:RotateTo(rotation, time, exp?)
TypeParameterDefaultDescription
Rotatorrotation
floattimeTime to interpolate from current location to target location
floatexp?0Exponent used to smooth interpolation. Use 0 for linear movement

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 boolean.

local ret = my_actor:IsBeingDestroyed()

IsVisibleโ€‹

Returns true if this Actor is visible

โ€” Returns boolean.

local ret = my_actor:IsVisible()

IsGravityEnabledโ€‹

Returns true if gravity is enabled on this Actor

โ€” Returns boolean.

local ret = my_actor:IsGravityEnabled()

IsInWaterโ€‹

Returns true if this Actor is in water

โ€” Returns boolean.

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 boolean.

local ret = my_actor:IsNetworkDistributed()

GetAttachedEntitiesโ€‹

Gets all Actors attached to this Actor

โ€” Returns table of Base Actor.

local ret = my_actor:GetAttachedEntities()

GetAttachedToโ€‹

Gets the Actor this Actor is attached to

โ€” Returns Base Actor or nil.

local ret = my_actor:GetAttachedTo()

GetBoundsโ€‹

Gets this Actor's bounds

โ€” Returns table (in the format { Origin: Vector, BoxExtent: Vector, SphereRadius: float }).

local ret = my_actor:GetBounds()

GetCollisionโ€‹

Gets this Actor's collision type

โ€” Returns CollisionType.

local ret = my_actor:GetCollision()

GetLocationโ€‹

Gets this Actor's location in the game world

โ€” Returns Vector.

local ret = my_actor:GetLocation()

GetRelativeLocationโ€‹

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

โ€” Returns Vector.

local ret = my_actor:GetRelativeLocation()

GetNetworkAuthorityโ€‹

Gets this Actor's Network Authority Player

โ€” Returns Player or nil.

local ret = my_actor:GetNetworkAuthority()

GetRotationโ€‹

Gets this Actor's angle in the game world

โ€” Returns Rotator.

local ret = my_actor:GetRotation()

GetRelativeRotationโ€‹

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

โ€” Returns Rotator.

local ret = my_actor:GetRelativeRotation()

GetForceโ€‹

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

โ€” Returns Vector.

local ret = my_actor:GetForce()

GetDimensionโ€‹

Gets this Actor's dimension

โ€” Returns integer.

local ret = my_actor:GetDimension()

See also DimensionChange.


HasNetworkAuthorityโ€‹

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

โ€” Returns boolean.

local ret = my_actor:HasNetworkAuthority()

HasAuthorityโ€‹

Gets if this Actor was spawned by the client side

โ€” Returns boolean (false if it was spawned by the Server or true if it was spawned by the client).

local ret = my_actor:HasAuthority()

GetScaleโ€‹

Gets this Actor's scale

โ€” Returns Vector.

local ret = my_actor:GetScale()

GetVelocityโ€‹

Gets this Actor's current velocity

โ€” Returns Vector.

local ret = my_actor:GetVelocity()

AddActorTagโ€‹

Adds an Unreal Actor Tag to this Actor

my_actor:AddActorTag(tag)
TypeParameterDefaultDescription
stringtag

See also RemoveActorTag, GetActorTags.


RemoveActorTagโ€‹

Removes an Unreal Actor Tag from this Actor

my_actor:RemoveActorTag(tag)
TypeParameterDefaultDescription
stringtag

See also AddActorTag, GetActorTags.


GetActorTagsโ€‹

Gets all Unreal Actor Tags on this Actor

โ€” Returns table of string.

local ret = my_actor:GetActorTags()

See also AddActorTag, RemoveActorTag.


WasRecentlyRenderedโ€‹

Gets if this Actor was recently rendered on screen

โ€” Returns boolean.

local ret = my_actor:WasRecentlyRendered()

GetDistanceFromCameraโ€‹

Gets the distance of this Actor from the Camera

โ€” Returns float.

local ret = my_actor:GetDistanceFromCamera()

GetScreenPercentageโ€‹

Gets the percentage of this Actor size in the screen

โ€” Returns float.

local ret = my_actor:GetScreenPercentage()

๐Ÿš€ย Eventsโ€‹

NameDescription
DimensionChangeTriggered 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)

end)
TypeArgumentDescription
Base Actorself
integerold_dimension
integernew_dimension
See also SetDimension, GetDimension.