-
Notifications
You must be signed in to change notification settings - Fork 0
API: Components
PhoenixWhitefire edited this page Oct 7, 2025
·
8 revisions
The Engine support an Entity Component System architecture, meaning that GameObject
s have their own "base" APIs, which can be extended by adding Components. These, as well as the base APIs, are all listed below.
-
Enabled: boolean
: Whether the Engine updates and recognizes this Object, essentially freezing it if it is disabled -
Exists: boolean
: Whether or not the Object still exists. Will be false after calling:Destroy
-
Name: string
: The name of the Object, usually what was passed intoGameObject.new
-
ObjectId: number
: The ID of the Object, an integer. Remains the same throughout the session, but not guaranteed between sessions -
Parent: GameObject?
: The hierarchal parent of the Object, ornil
if it does not have one -
Serializes: boolean
: Whether or not the Object should be saved with the scene if it is serialized withscene_save
, and whether:Duplicate
will duplicate (only applies to descendants)
-
Destroy() : ()
: Marks the Object as "pending for destruction". This may or may not remove the Object from memory immediately, depending on whether the Engine is actively using the Object for some purpose -
Duplicate() : (GameObject)
: Creates a duplicate of the Object -
FindChild(string) : (GameObject?)
: Returns the child Object with the given name, ornil
if it doesn't exist -
ForEachChild((any) -> (any)) : ()
: For all children of the Object, invokes the callback. If the callback explicitly returnsfalse
, iteration ends early. Callback cannot yield -
GetChildren() : ({ any })
: Returns a list of the Object's direct children -
GetComponentNames() : ({ any })
: Returns a list of the names of all Components that the Object currently has -
GetDescendants() : ({ any })
: Returns all descendants of the Object (i.e. its children, and their children, etc) -
GetFullName() : (string)
: Returns the full, hierarchal path of the Object -
HasComponent(string) : (boolean)
: Returns whether or not the Object has the given Component -
IsA(string) : (boolean)
: Equivalent to:HasComponent
-
MergeWith(GameObject) : ()
: Merges the Objects together, replacing descendants with the same name
- Represents an Animation
- Not functional currently
-
Animation: string
: The animation file -
Looped: boolean
: Whether the Animation should loop when it reaches the end -
Playing: boolean
: Whether the Animation is playing -
Ready: boolean
: Whether the Animation can be played -
Weight: number
: The influence the Animation has over the rig
- Represents a Bone of a Mesh
- Created automatically when the asset of a Mesh component finishes loading
-
IsActive: boolean
: Whether or not the Bone Object is actively affecting a Mesh -
SkeletalBoneId: number
: The internal ID of the bone, valid range is 0-126 -
Transform: Matrix
: The transformation of the Bone
- A 3D camera
-
FieldOfView: number
: The field-of-view. By default,70
-
Transform: Matrix
: Where it is in 3D space -
UseSimpleController: boolean
: Whether it is affected by the built-in controller (W
/A
/S
/D
horizontal movement,Q
/E
vertical, Mouse to look around)
- The root of the scene
-
Time: number
: Number of seconds since the Engine started running
-
OnFrameBegin(number)
: Fires at the beginning of a frame, passing in the time elapsed since the last frame (delta time)
- Intended to model a large light source infinitely far away, like the Sun
-
Brightness: number
: How bright the Light is -
Direction: vector
: The direction light is emitted from -
LightColor: Color
: The color of the Light -
ShadowViewDistance: number
: How far back the shadow view is offset from the focus -
ShadowViewFarPlane: number
: The Far Z plane of the shadow view. Should be greater thanShadowViewNearPlane
-
ShadowViewMoveWithCamera: boolean
: Sets the focus of the shadow view to be the Scene Camera -
ShadowViewNearPlane: number
: The Near Z plane of the shadow view. Should be less thanShadowViewFarPlane
. Shouldn't be0
-
ShadowViewOffset: vector
: Offset of the shadow view from the focus, afterShadowViewDistance
is applied -
ShadowViewSize: number
: Size of the shadow view. SetsShadowViewSizeH
andShadowViewSizeV
to the assigned value if they are equal. Is-1
if they are not equal -
ShadowViewSizeH: number
: Horizontal size of the shadow view -
ShadowViewSizeV: number
: Vertical size of the shadow view -
Shadows: boolean
: Whether the Light can render shadows
- An example to be made fun of and bullied
- The least-popular kid in school no one remembers the name of
-
EvenMoreSecretMessage: string
: A secret message that's so, so secret that it cannot be read by Reflection-kun, almost like they're keeping a secret from her... -
SecretMessage: string
: A secret message that's so important it's read-only -
SomeInteger: number
: An integer -
SuperCoolBool: boolean
: A boolean -
WhereIAm: vector
: A 3-dimensional vector quantity
-
GiveUp() : ()
: Tells Engine-chan to kill herself and throws an exception -
Greet({ any }, boolean) : (string, string)
: Says hello to the given list of names. If the second argument istrue
, does so extra villainously
-
OnGreeted(string, string)
: Fires when:Greet
is called, and sends the response to the callback before the original caller of:Greet
receives it
- A mesh composed of triangles
-
AngularVelocity: vector
: Its rotational velocity -
Asset: string
: The path to the underlying.hxmesh
file, or a built-in identifier like!Quad
or!Cube
-
CastsShadows: boolean
: Whether it casts shadows (not functional currently) -
CollisionFidelity: number
: 0 -Aabb
: An axis-aligned bounding box. 1 -AabbStaticSize
: An AABB which keeps the same size as the Object -
Density: number
: Its density (Mass = Density * Size
) -
FaceCulling: number
: An integer.0
means no culling,1
to cull its "back" faces, and2
to cull its "front" faces -
Friction: number
: Fraction of Velocity it should lose per second while in contact with another object whilePhysicsDynamics
istrue
-
LinearVelocity: vector
: Its velocity -
Material: string
: The name of the.mtl
in theresources/materials/
directory it should use -
MetallnessFactor: number
: Metallness modifier -
PhysicsCollisions: boolean
: Whether other physics objects can collide with it -
PhysicsDynamics: boolean
: Whether the Physics Engine should apply forces to it -
RoughnessFactor: number
: Roughness modifier -
Tint: Color
: The Color it should be tinted with -
Transparency: number
: Its transparency/translucency
- A container
No members defined
- An emitter of 2D particles
-
Emitting: boolean
: Whether the emitter should emit new particles -
Lifetime: Vector2
: The X and Y components act as a range of how long any particle can last, in seconds -
ParticlesAreAttached: boolean
: Whether the particles are attached to and move with the emitter -
Rate: number
: An integer indicating how many particles should be emitted per second (must be above or equal to0
)
- A light source emitting light omnidirectionally from its
Transform
-
Brightness: number
: How bright the Light is -
LightColor: Color
: The color of the Light -
Range: number
: How far light is emitted. If>= 0
, the Range is used and attenuation is linear, otherwise the formulaR = 1/D^2
, whereD
is the distance of any point in 3D space having its lighting calculated from the PointLight, is used for real-world attenuation -
Shadows: boolean
: Whether the Light can render shadows
- A Luau script
-
SourceFile: string
: The File the Script is executing. Changing this to a valid File immediately reloads the Script if it is a descendant of theDataModel
(i.e.game
). To forcefully reload it,:Reload
should be used
-
Reload() : (boolean)
: Re-compiles the Source file and runs it from the beginning, returning whether the compilation and initial run were successful
- A sound
-
FinishedLoading: boolean
: Whether the Sound has finished loading theSoundFile
-
Length: number
: The length of the sound in seconds -
LoadSucceeded: boolean
: Whether or not the sound loaded successfully -
Looped: boolean
: Whether playback should loop once it reaches the end -
Playing: boolean
: Whether the Sound is currently playing (or requested to play, if.Playing
is set totrue
by aScript
before it has finished loading) -
Position: number
: Number of seconds from beginning of the file -
SoundFile: string
: The sound file to be played -
Speed: number
: The speed at which the sound plays, within the range of 0.01 to 100 -
Volume: number
: The volume at which the sound plays. Must be positive
-
OnLoaded(boolean)
: Fires when the Sound finishes loading, and whether it loaded successfully or not
- A light which emits in a conical shape
-
Angle: number
: The Field-of-View (in radians) of light emission -
Brightness: number
: How bright the Light is -
LightColor: Color
: The color of the Light -
Range: number
: How far light is emitted -
Shadows: boolean
: Whether the Light can render shadows
- Gives a physical position and size to Object
-
Size: vector
: The Size of the Object influenced by the Component -
Transform: Matrix
: The Transformation of the Object from the World
- The Engine, for rendering and physics, will pretend the children of this Object's
Target
are the children of the node - There is one very specific use-case for which this was implemented, this was designed around said use-case. It is not intended to act like a transparent proxy
-
Scripting: boolean
: Whether Scripts which descend from theTarget
will run -
Target: GameObject?
: The target to link
- The container used for storing the main parts of a scene (3D objects)
- If this is
Destroy
'd, the application closes
-
SceneCamera: GameObject
: TheCamera
the Player sees the world through. If set tonil
, a fallback is created at the origin.
-
ScreenPointToRay({ any }, number) : (vector)
: Converts the provided X and Y screen coordinates to a world-space vector, with the length provided or1
by default