bevy-camera-systems
Installation
SKILL.md
Bevy camera systems
When to use
Load this when a view must render 2D or 3D. Camera, Camera2d, Camera3d, and the two_passes example are the sources for the names below. The library pin is 0.20.
ECS shape
- Components:
Camerais the viewpoint (projection and render target). ACamerawith no render graph errors at runtime.Camera2denables the 2D graph and requiresCamera,Projection, andFrustum.Camera3denables the main 3D graph and requiresCameraandProjection. 3D space is right-handed: X right, Y up, Z back, so forward is -Z. - Spawn: the example uses
commands.spawn((Camera3d::default(), Transform::from_xyz(...).looking_at(Vec3::ZERO, Vec3::Y))). A second camera setsCamera { order: 1, clear_color: ClearColorConfig::None, ..default() }so it draws on top without clearing. - Query: systems may take
(&Camera, &GlobalTransform)withWith<Camera2d>.Camera::viewport_to_world_2dmaps a viewport position to a 2D world position for an orthographic camera along Z. - Schedule: spawn on
Startup. Follow, split viewports, and trauma offset are your components onUpdate.