Skip to content

A simple pan and orbit camera for the Bevy game engine

License

Notifications You must be signed in to change notification settings

Threadzless/bevy_panorbit_camera

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crates.io docs.rs Bevy tracking

Bevy Pan/Orbit Camera

A screen recording showing camera movement

What Is This?

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!

Default controls:

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

Features:

  • Orbiting, panning and zooming
  • Smooth orbiting motion
  • Works with orthographic camera projection in addition to perspective
  • Customisable controls, sensitivity, and more
  • Works with multiple viewports and/or windows
  • Easy to control manually, e.g. for keyboard control or animation

Quick Start

Add the plugin:

.add_plugin(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.

What are alpha and beta?

Think of this camera as rotating around a point, and always pointing at that point (the focus). The sideways rotation, i.e. the longitudinal rotation, is alpha, and the latitudinal rotation is beta. Both are measured in radians. If alpha and beta are both 0.0, then the camera will be looking directly forwards (-Z direction). Increasing alpha will rotate around the focus to the right, and increasing beta will move the camera up and over the focus.

Cargo Features

  • bevy_egui: makes PanOrbitCamera ignore input when interacting with egui widgets/windows
  • bevy-inspector-egui: Add some

Version Compatibility

bevy bevy_panorbit_camera
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.

Contributing

Pull requests are welcome! By contributing code to this repository you agree to license it under the dual MIT+Apache license as detailed above.

About

A simple pan and orbit camera for the Bevy game engine

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 100.0%