#camera-control #camera #bevy #3d #gamedev #game-engine #freecam

bevy_awesome_debug_camera

A easy-to-use customizable drop-in free cam for the (awesome) bevy engine

1 unstable release

0.1.0 Jul 6, 2024

#1937 in Game dev

Unlicense

34KB
291 lines

Bevy Debug Camera

This repository contains a custom debug camera system for applications built using the Bevy game engine. This system provides flexible and configurable camera controls, including movement, rotation, and zooming, which are essential for debugging and developing 3D applications.

Features

  • Customizable Keymaps: Move the camera using customizable keybindings.
  • Elegant Camera Mouse Controls: Look around with the mouse with vertical rotation clamping and a consistent up.
  • Mouse Wheel Enabled Zoom: Zoom in and out using the mouse scroll wheel.
  • Full Game Pad Support: Controll all features with a controller instead of mouse and keyboard.
  • Cursor Capture: Allow cursor capture in windows with an active debug camera for increased comfort.
  • Camera Local Option Overrides: Replace the global options resource with local per-camera overrides.

Usage

This crate revolves around the DebugCamera component, which exposes the implemented functionality to any camera it is added to. Most functionally requires any user to add the DebugCameraPlugin to the app as well though.

For gettting started check out the examples.

Using Custom Configuration

Most features of this crate are thoroughly customizable through the debug_camera_options field on DebugCameraPlugin. All available options are available in the documentation of DebugCameraOptions.

let debug_camera_options = DebugCameraOptions {
    // Update any configuration here!
    ..Default::default()
};

App::new()
    .add_plugins((DefaultPlugins, DebugCameraPlugin {
        debug_camera_options,
        ..Default::default()
    }))
    .run();

Keybindings

To avoid conflicts, DebugCameraOptions and InputOptions don't come with preconfigured keybindings. You can either provide custom KeyBindings or use one of the preconfigured instances. KeyBindings constructed through Default::default are preconfigured. You can see the keymap used by them in the table below.

Action Key Field
Move Forward W forward
Move Backward S back
Move Left A left
Move Right D right
Move Up Q up
Move Down E down
Elevate R global_up
Descend F global_down

Bevy Version Compatibility

bevy version bevy_awesome_debug_camera version
0.14 0.1

Contributing

Contributions are welcome! Please feel free to open an issue or submit a pull request.

Dependencies

~25MB
~463K SLoC