Expand description
The ground the balls land on: one fixed body in physics, one instance in the render world, wearing a checker so motion reads against it.
The floor is the scene’s only fixed body, and the only instance that never moves, so it is built once and then left alone: the ground is queued before anything can drop on it, and afterwards there is nothing to do. The instance is built by one job in the render world, so the mesh, the checker and the instance that names them need no round trip between them.
Re-exports§
use glam::Vec3;🔒use unlit_ecs::World;🔒use unlit3d::components::Transform;🔒use super::Scene;🔒use crate::render::allocate_mesh;🔒use crate::render::allocate_rgba_material;🔒use crate::render::cuboid_mesh;🔒use crate::render::instance_of;🔒use crate::render::linear_sampler;🔒use unlit3dx::prelude::*;🔒
Constants§
- GROUND_
CHECKER_ DARK - The checker’s darker square, as sRGB bytes.
- GROUND_
CHECKER_ SIZE - The ground texture’s edge length in pixels; the checker draws eight
squares per side, so each square is a block of
GROUND_CHECKER_SIZE / 8pixels. - GROUND_
CHECKER_ 🔒SQUARES - The checker squares per texture side.
- GROUND_
COLOR - The ground’s base color, as sRGB bytes.
- GROUND_
FRICTION 🔒 - The friction the ground gives the balls.
- GROUND_
HALF - The ground box’s half extents, in metres.
- GROUND_
POSITION - Where the ground box sits; its top face is the y = 0 plane.
Functions§
- checker_
ground - The ground’s checker texture:
GROUND_CHECKER_SQUARESsquares per side, the light ones inGROUND_COLORand the dark ones inGROUND_CHECKER_DARK. - ground_
job 🔒 - The job that builds the ground’s instance in the render world.
- spawn_
floor - Put the ground under the scene: one fixed body in physics, one instance in the render world.