Nightshade provides 59 built-in components across several categories. Core components (45) are listed below. UI components (10) are covered in Retained UI and Sprite2D components (4) in Sprites.
| Component | Description |
LocalTransform | Position, rotation, scale relative to parent |
GlobalTransform | Computed world-space transformation matrix |
LocalTransformDirty | Marker for transforms needing propagation |
Parent | Parent entity reference for hierarchy |
IgnoreParentScale | Exclude parent's scale from transform hierarchy |
Rotation | Additional rotation component |
#![allow(unused)]
fn main() {
pub struct LocalTransform {
pub translation: Vec3,
pub rotation: Quat,
pub scale: Vec3,
}
pub struct GlobalTransform(pub Mat4);
pub struct Parent(pub Option<Entity>);
}
| Component | Description |
RenderMesh | References mesh by name |
MaterialRef | References material by name |
Sprite | 2D billboard rendering |
RenderLayer | Depth/layer for ordering |
CastsShadow | Marks mesh for shadow maps |
Visibility | Visibility toggle |
BoundingVolume | Bounding volume for culling and picking |
InstancedMesh | GPU-instanced mesh data |
#![allow(unused)]
fn main() {
pub struct RenderMesh {
pub name: String,
pub id: Option<MeshId>,
}
pub struct MaterialRef {
pub name: String,
pub id: Option<MaterialId>,
}
}
MaterialRef::new(name) takes impl Into<String>, so you can pass &str directly:
#![allow(unused)]
fn main() {
MaterialRef::new("Default")
}
| Component | Description |
Camera | Projection mode and smoothing |
PanOrbitCamera | Orbiting camera controller |
There is a single CAMERA component flag. The projection type is determined by the Projection enum inside the Camera struct:
#![allow(unused)]
fn main() {
pub struct Camera {
pub projection: Projection,
pub smoothing: Option<Smoothing>,
}
pub enum Projection {
Perspective(PerspectiveCamera),
Orthographic(OrthographicCamera),
}
pub struct PerspectiveCamera {
pub aspect_ratio: Option<f32>,
pub y_fov_rad: f32,
pub z_far: Option<f32>,
pub z_near: f32,
}
pub struct OrthographicCamera {
pub x_mag: f32,
pub y_mag: f32,
pub z_far: f32,
pub z_near: f32,
}
}
| Component | Description |
Light | Directional, Point, or Spot light |
#![allow(unused)]
fn main() {
pub struct Light {
pub light_type: LightType,
pub color: Vec3,
pub intensity: f32,
pub range: f32,
pub cast_shadows: bool,
pub shadow_bias: f32,
pub inner_cone_angle: f32,
pub outer_cone_angle: f32,
}
pub enum LightType {
Directional,
Point,
Spot,
}
}
| Component | Description |
RigidBodyComponent | Dynamic/Fixed/Kinematic body |
ColliderComponent | Collision shape |
CharacterControllerComponent | Kinematic player controller |
PhysicsInterpolation | Smooth physics rendering |
CollisionListener | Receives collision events |
#![allow(unused)]
fn main() {
pub struct RigidBodyComponent {
pub handle: Option<RigidBodyHandle>,
pub body_type: RigidBodyType,
pub translation: [f32; 3],
pub rotation: [f32; 4],
pub linvel: [f32; 3],
pub angvel: [f32; 3],
pub mass: f32,
pub locked_axes: LockedAxes,
}
pub enum RigidBodyType {
Dynamic,
Fixed,
KinematicPositionBased,
KinematicVelocityBased,
}
}
Constructor methods:
RigidBodyComponent::new_dynamic()
RigidBodyComponent::new_static() (creates a Fixed body type)
RigidBodyComponent::new_kinematic() (creates KinematicPositionBased)
The component flag for rigid bodies is RIGID_BODY (not RIGID_BODY_COMPONENT).
| Component | Description |
AnimationPlayer | Animation playback control |
Skin | Skeleton definition |
Joint | Bone in skeleton |
MorphWeights | Blend shape weights |
#![allow(unused)]
fn main() {
pub struct AnimationPlayer {
pub clips: Vec<AnimationClip>,
pub current_clip: Option<usize>,
pub blend_from_clip: Option<usize>,
pub blend_factor: f32,
pub playing: bool,
pub speed: f32,
pub time: f32,
pub looping: bool,
}
}
| Component | Description |
AudioSource | Sound playback |
AudioListener | 3D audio receiver |
| Component | Description |
Text | 3D world text and screen-space UI text |
TextCharacterColors | Per-character text colors |
TextCharacterBackgroundColors | Per-character text background colors |
| Component | Description |
Lines | Debug line rendering |
#![allow(unused)]
fn main() {
pub struct Lines {
pub lines: Vec<Line>,
}
pub struct Line {
pub start: Vec3,
pub end: Vec3,
pub color: Vec4,
}
}
| Component | Description |
ParticleEmitter | GPU particle system |
GrassRegion | Procedural grass field |
GrassInteractor | Grass bending interaction |
NavMeshAgent | AI pathfinding agent |
Water | Water surface/volume |
Decal | Projected texture |
Lattice | Lattice deformation controller |
LatticeInfluenced | Entity deformed by a lattice |
Tween | Tween animation component |
PrefabSource | Source prefab reference |
PrefabInstance | Instance of a spawned prefab |
Script | Scripting component (requires scripting feature) |
Hovered | Input hover state |
Name | String identifier |