bevy_top_down_camera

Crates.iobevy_top_down_camera
lib.rsbevy_top_down_camera
version0.3.0
created_at2025-07-25 18:49:15.89276+00
updated_at2026-01-21 14:19:50.262984+00
descriptionA top down camera written for Bevy
homepagehttps://github.com/olekspickle/bevy_top_down_camera
repositoryhttps://github.com/olekspickle/bevy_top_down_camera
max_upload_size
id1767911
size164,108
Oleks Pickle (olekspickle)

documentation

README

Bevy Top Down Camera

  • Move around by hovering cursor to the edges of the screen
  • Zoom in/out
  • Rotate horizontally to change observable angle preserving pitch and yaw
  • Follow target

camera demo smooth follow

Getting Started

Add the bevy_top_down_camera crate:

cargo add bevy_third_person_camera

Import the bevy_top_down_camera crate:

use bevy_top_down_camera::*;

Add the TopDownCameraPlugin:

.add_plugins(TopDownCameraPlugin)

Add the TopDownCamera component to the camera entity:

commands.spawn((
    Camera3d::default(),
    TopDownCamera::default(),
));

If you want camera to follow the player, add the TopDownCameraTarget component to your player:

// Player
commands.spawn((
    MeshMaterial3d(materials.add(Color::WHITE)),
    Mesh3d(meshes.add(Mesh::from(Cuboid::new(1.0, 1.0, 1.0)))),
    Transform::from_translation(Vec3::new(0.0, 0.5, 0.0)),
    TopDownCameraTarget,
    Player,
));

Custom Settings

Most settings can be overridden:

commands.spawn((
    // These are the default settings
    TopDownCamera {
            motion: Motion {
                follow: true,
                move_speed: 0.05,
                max_speed: 200.0,
                rotate_speed: 0.01,
                edge_margin: Vec2::splat(30.0),
                ..default()
            },
            zoom: Some((5.0, 50.0).into()),
            height: Some((5.0, 50.0).into()),
            height_rise_key: KeyCode::KeyX.into(),
            height_lower_key: KeyCode::KeyZ.into(),
            rotate_key: MouseButton::Right.into(),
            ..default()
    },
    Camera3d::default(),
));

Physics Support

When using third party physics engines such as bevy rapier 3d or avian 3d, you should force the 'sync_player_camera' system to run after the physics systems. Failing to do this will cause a jittering effect to occur when applying forces/impulses to an object that has a camera entity attached. Simply add the following to your App::new() method (also see examples/physics.rs for complete example):

.configure_sets(PostUpdate, CameraSyncSet.after(PhysicsSet::StepSimulation)) // Bevy Rapier 3d
.configure_sets(PostUpdate, CameraSyncSet.after(PhysicsSet::Sync)) // Avian 3d

Default Controls

Action Mouse/Keyboard Enabled by Default
Zoom In Scroll Up Yes
Zoom Out Scroll Down Yes
Rotate Right Mouse Button Yes
Move around Hover to screen edges Yes
Follow - No

Bevy Version Compatibility

bevy bevy_top_down_camera
0.18 0.18.0
0.17 0.2.0
0.16 0.1.0 - 0.1.5

License

Commit count: 16

cargo fmt