bevy_pancam
A 2d camera plugin for bevy that works with orthographic cameras.
The motivation is that this could be used for something like a map editor for a 2d game.
Controls
Behaves similarly to common online map applications:
- Click and drag to move the camera
- Scroll to zoom
- Hold keyboard buttons to move the camera
Usage
Add the plugin to your app
new
.add_plugins
.run;
Add the component to an orthographic camera:
commands.spawn
This is enough to get going with sensible defaults.
Alternatively, set the fields of the PanCam component to customize behavior:
commands.spawn;
See the simple and toggle examples.
Cargo features
bevy_egui_<major>_<minor>makes pancam cameras not react when the mouse or keyboard focus is on widgets created with the specificbevy_eguirelease. The feature is suffixed with the egui version becausebevy_eguitypically releases multiple breaking versions per Bevy release, and we don't want to be forced to break on everybevy_eguirelease.
Bevy Version Support
The main branch targets the latest bevy release.
| bevy | bevy_pancam |
|---|---|
| 0.18 | 0.20, main |
| 0.17 | 0.19 |
| 0.16 | 0.18 |
| 0.15 | 0.16, 0.17 |
| 0.14 | 0.12, 0.13, 0.14, 0.15 |
| 0.13 | 0.11 |
| 0.12 | 0.10 |
| 0.11 | 0.9 |
| 0.10 | 0.8 |
| 0.9 | 0.7, |
| 0.8 | 0.5, 0.6 |
| 0.7 | 0.3, 0.4 |
| 0.6 | 0.2 |
| 0.5 | 0.1 |
License
bevy_pancam is dual-licensed under either
- MIT License (./LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (./LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
at your option.
Contributions
PRs welcome!