Actors
If a Level is a movie set, then Actors are the props, people, lights, and cameras on that set. Every object you place in a HELIX world is an Actor. That chair? Actor. That streetlight? Actor. That invisible trigger zone that opens a door? Also an Actor.
AActor is the base class for everything that exists in a Level.
Common Actor Types
| Type | What it does |
|---|---|
| Static Mesh Actor | A 3D model that doesn't move (walls, rocks, furniture) |
| Character | A movable, controllable entity (players, NPCs) |
| Light | Point lights, spotlights, directional lights |
| Camera | Viewpoints for players or cutscenes |
| Trigger Volume | Invisible boxes that fire events when something enters them |
| Player Start | Where players spawn into the world |
Spawning an Actor
You can place Actors in HELIX Studio by dragging them into the viewport, but you can also spawn them at runtime through code:
- Blueprint
- Lua
- JavaScript
-- Spawn an actor at a specific location
local MyClass = LoadClass("/Game/Blueprints/MyActor.MyActor_C")
local spawn_transform = Transform()
spawn_transform.Translation = Vector(100, 200, 50)
spawn_transform.Rotation = Rotator(0, 0, 0):ToQuat()
spawn_transform.Scale3D = Vector(1, 1, 1)
local new_actor = HWorld:SpawnActor(
MyClass,
spawn_transform,
ESpawnActorCollisionHandlingMethod.AlwaysSpawn
)
// Spawn an actor at a specific location
// Note: Actor spawning in JavaScript follows similar patterns to Lua.
// Use the HWorld global and SpawnActor method:
const MyClass = LoadClass("/Game/Blueprints/MyActor.MyActor_C");
let spawnTransform = new Transform();
spawnTransform.Translation = new Vector(100, 200, 50);
spawnTransform.Rotation = new Rotator(0, 0, 0).ToQuat();
spawnTransform.Scale3D = new Vector(1, 1, 1);
let newActor = HWorld.SpawnActor(
MyClass,
spawnTransform,
ESpawnActorCollisionHandlingMethod.AlwaysSpawn
);
Destroying Actors
When you're done with an Actor (a projectile that hit something, a pickup that was collected), destroy it to free up memory:
- Blueprint
- Lua
- JavaScript
actor_to_destroy:K2_DestroyActor()
actorToDestroy.K2_DestroyActor();
Finding Actors
Need to grab a reference to an Actor already in the world? You can find them by class, by tag, or by name using GetAllActorsOfClass, GetAllActorsWithTag, or by storing a reference in a variable.
Avoid searching for actors every frame. Grab your references once in BeginPlay and store them in variables.