| 1 |
--- |
| 2 |
title: Pan Orbit Camera |
| 3 |
authors: ["@aevyrie, @taishi-sama"] |
| 4 |
pull_requests: [25434] |
| 5 |
--- |
| 6 |
|
| 7 |
Upstream of awesome crate [`bevy_editor_cam`](https://github.com/aevyrie/bevy_editor_cam) made by [@aevyrie](https://github.com/aevyrie) as part of `bevy_camera_controller` crate! |
| 8 |
|
| 9 |
## Usage |
| 10 |
|
| 11 |
Add `MeshPickingPlugin` and `DefaultPanOrbitCameraPlugins` plugin. |
| 12 |
|
| 13 |
```rust |
| 14 |
app.add_plugins(( |
| 15 |
MeshPickingPlugin, |
| 16 |
DefaultPanOrbitCameraPlugins, |
| 17 |
)) |
| 18 |
``` |
| 19 |
|
| 20 |
Then add `PanOrbitCamera` component on any 3D camera. |
| 21 |
|
| 22 |
```rust |
| 23 |
commands.spawn(( |
| 24 |
Camera3d::default(), |
| 25 |
PanOrbitCamera::default(), |
| 26 |
)) |
| 27 |
``` |
| 28 |
|
| 29 |
Full functionality is shown in the `camera/pan_orbit_camera_cad` example |
| 30 |
|
| 31 |
```sh |
| 32 |
cargo run --example pan_orbit_camera_cad --features='pan_orbit_camera https 3d_api jpeg' |
| 33 |
``` |