#camera-control #camera #bevy #orbit #gamedev #game-engine

bevy_panorbit_camera

A basic pan and orbit camera in Bevy

38 releases (19 breaking)

0.20.0 Nov 6, 2024
0.19.3 Aug 30, 2024
0.19.1 Jul 9, 2024
0.17.0 Mar 25, 2024
0.6.1 Jul 14, 2023

#20 in Game dev

Download history 410/week @ 2024-07-27 328/week @ 2024-08-03 446/week @ 2024-08-10 414/week @ 2024-08-17 502/week @ 2024-08-24 589/week @ 2024-08-31 421/week @ 2024-09-07 504/week @ 2024-09-14 641/week @ 2024-09-21 571/week @ 2024-09-28 278/week @ 2024-10-05 564/week @ 2024-10-12 829/week @ 2024-10-19 591/week @ 2024-10-26 763/week @ 2024-11-02 195/week @ 2024-11-09

2,461 downloads per month
Used in 21 crates (19 directly)

MIT/Apache

57KB
844 lines

Crates.io docs.rs Bevy tracking

Bevy Pan/Orbit Camera

A screen recording showing camera movement

Summary

Bevy Pan/Orbit Camera provides orbit camera controls for Bevy Engine, designed with simplicity and flexibility in mind. Use it to quickly prototype, experiment, for model viewers, and more!

Features:

  • Smoothed orbiting, panning, and zooming
  • Works with orthographic camera projection in addition to perspective
  • Customisable controls, sensitivity, and more
  • Touch support
  • Works with multiple viewports and/or windows
  • Easy to control manually, e.g. for keyboard control or animation
  • Can control cameras that render to a texture

Controls

Default mouse controls:

  • Left Mouse - Orbit
  • Right Mouse - Pan
  • Scroll Wheel - Zoom

Default touch controls:

  • One finger - Orbit
  • Two fingers - Pan
  • Pinch - Zoom

Quick Start

Add the plugin:

.add_plugins(PanOrbitCameraPlugin)

Add PanOrbitCamera to a camera:

commands.spawn((
    Camera3dBundle {
        transform: Transform::from_translation(Vec3::new(0.0, 1.5, 5.0)),
        ..default()
    },
    PanOrbitCamera::default(),
));

This will set up a camera with good defaults.

Check out the advanced example to see all the possible configuration options.

Cargo Features

  • bevy_egui (optional): Makes PanOrbitCamera ignore any input that egui uses, thus preventing moving the camera when interacting with egui windows

Version Compatibility

bevy bevy_panorbit_camera
0.14 0.19-0.20
0.13 0.14-0.18
0.12 0.9-0.13
0.11 0.6-0.8
0.10 0.1-0.5

Credits

License

All code in this repository is dual-licensed under either:

at your option. This means you can select the license you prefer! This dual-licensing approach is the de-facto standard in the Rust ecosystem and there are very good reasons to include both.

Dependencies

~36–74MB
~1.5M SLoC