EntityProps
EntityProps =
object&BodyDeclaration
What an Entity takes: its own props, and its body and collider.
Without a collider the entity has no body: a character’s is its own,
and a coin without one is walked through. A collider with no body is a
fixed body; a change to either after spawn edits the body in place.
Type Declaration
Section titled “Type Declaration”| Name | Type | Description |
|---|---|---|
ai? |
AiMetadata |
What it is and what can be done with it, in words, over what its behaviours say: its node in the AI tree. |
animation? |
string |
The name of the model file’s clip to loop, such as walk. A name the file lacks plays nothing, and a dev world warns once with the names it has. |
authority? |
AuthorityContext |
- |
material? |
ModelMaterial |
What its model wears in place of each of the file’s materials, handed the one the file gave the mesh, such as a dissolve over the file’s texture: the material the model registered with when left out. The engine asks the function once for each of the file’s materials and keeps what it returns, so every Entity handed the same function wears the same materials, and the animated ones draw together in one draw per mesh; a second function draws in a batch of its own. Define it once, outside the component: a function made anew each render makes new materials each render. The material it returns is the game’s to dispose. |
model? |
string |
The name of a registered model, or a path the game serves such as assets/statue.glb, read from the page’s own folder, drawn inside the entity’s group. |
name? |
string |
The entity’s row name in the devtools tree; the component’s own when left out. |
position? |
Position |
Where it stands, [x, y, z] in metres. |
prefab? |
Prefab |
The kind of entity it is, as definePrefab declared it: its traits, model, body and collider, which a system’s spawn of the same prefab gives too. The Entity’s own model, animation, body and collider go over the prefab’s, and its pose is the Entity’s. |
rotation? |
RotationInput |
How the entity is turned: three Euler angles in radians, in three.js’s default order, as React Three Fiber’s rotation prop takes them, or a quaternion. Its collider turns with it. |
scale? |
ScaleInput |
How large the entity is: one number for every axis, three, or a vector. Its collider and its model scale with it; a sphere takes one number for every axis and a capsule the same across x and z. |