Skip to main content

Module components

Module components 

Source
Expand description

Built-in components. Every one is plain serde data plus an optional fields() listing for the inspector.

Re-exports§

pub use crate::audio::AudioSource;
pub use crate::gui::UiElement;
pub use crate::gui::UiKind;
pub use crate::mesh_edit::EditableMesh;
pub use crate::neural::NeuralAgent;
pub use crate::animation::TransformAnimation;
pub use crate::cloth::Cloth;
pub use crate::gameplay::Lifetime;
pub use crate::gameplay::Tags;
pub use crate::gameplay::Visibility;
pub use crate::grass::Grass;
pub use crate::tree::Tree;
pub use crate::tree::TreePart;
pub use crate::decal::Decal;
pub use crate::interaction::Slider;
pub use crate::interaction::Switch;
pub use crate::meshmod::MeshModifiers;
pub use crate::meshmod::ModifierStateCell;
pub use crate::paint::TexturePaint;
pub use crate::particles::ParticleEmitter;
pub use crate::skeletal::Animator;
pub use crate::skeletal::AnimatorState;
pub use crate::ik::CharacterIk;
pub use crate::ragdoll::Ragdoll;
pub use crate::modifiers::Bob;
pub use crate::modifiers::ColorCycle;
pub use crate::modifiers::Pulse;
pub use crate::modifiers::Spin;
pub use crate::modifiers::Wobble;
pub use crate::tween::MoveTween;
pub use crate::voxel::VoxelClouds;
pub use crate::voxel::VoxelSmoke;
pub use crate::water::VoxelWater;

Structs§

Camera
Perspective or orthographic scene camera. The first primary camera is selected for gameplay.
Collider
Collision shape. size is the full extent: box = (w, h, d); sphere = diameter in x; capsule/cylinder = diameter in x and total height in y; mesh/hull = a multiplier on the model (MeshRenderer.mesh, a box of size if it has none). Scaled by the entity’s world scale. Without a RigidBody on the entity or an ancestor it is static geometry.
DynamicMesh
Geometry produced at run time by a system (cloth, smoke, grass…). Not saved in scenes. Bump version whenever data changes so the renderer re-uploads it.
GlobalTransform
World-space matrix, recomputed every frame from Transform and Parent.
GrassChunk
Marks a chunk entity created for a grass patch.
Joint
Connects this entity’s RigidBody to another body (by entity name) or to the world if target is empty. The joint is attached where the bodies currently are, so place objects first. Fixed: weld at the current pose. Ball/Hinge: pivot at anchor (local to this entity). Spring: anchor is where the other end is attached, relative to this entity.
Light
Directional, point or spot light with optional directional shadow casting.
MeshRenderer
Static/procedural mesh appearance consumed by the renderer. Texture/shader paths are asset-relative or built-in procedural keys.
Name
Human-readable entity label. Names are not required to be unique.
Parent
Runtime link to the parent entity. Saved in scenes as an index, not as a component.
RigidBody
Physics body configuration and per-step motion requests. Dynamic results are written back into Transform and velocity by Physics::step.
ScriptSlot
One attached native script type and its saved editable properties.
Scripts
Rust scripts attached to an entity (several allowed). Property values live in props.
Shape
Parametric mesh. When an entity has both Shape and MeshRenderer, the shape is what is drawn.
Transform
Local translation, Euler rotation and scale relative to the parent.
Transient
Marks entities created by systems (e.g. grass chunks). They are hidden from the hierarchy, never saved in scenes and not pickable.

Enums§

BodyKind
Dynamic bodies respond to forces, Fixed bodies stay still, Kinematic bodies follow transforms.
JointKind
Fixed weld, freely rotating ball, limited hinge, or damped spring constraint.
LightKind
Directional lights illuminate globally; point/spot lights have a finite range.
ShapeKind
Collider shapes. Primitives use full extents; Mesh is the exact triangles of the entity’s model (for static level geometry), Hull its convex hull (for moving props).
ShapeType
Procedural mesh families. Cube/plane use size, round shapes use radii, and Rock uses seed.

Traits§

Component
Editor-visible component contract: identity, serde persistence and editable fields. Built-ins are registered in both register_all and crate::registry::Registry. Script libraries may access built-ins but must not register custom unloadable storage.

Functions§

active_camera
The camera the game looks through: the first primary camera, else the first camera at all.
mesh_key
The mesh key an entity is drawn with: dynamic geometry, else its Shape, else MeshRenderer.mesh.
register_all
Creates the storage of every built-in component. Must run on every new World.
set_active_camera
Makes camera the only primary camera (the one the game looks through).