/bevy_dolly

h3r2tic's dolly abstraction layer for the bevy game framework

Primary LanguageRustApache License 2.0Apache-2.0

bevy_dolly

Static Pinned
bevy dolly static bevy dolly pinned

bevy_dolly is a prototype plugin using h3r2tic's powerful crate: dolly, implemented for bevy.

Feedback - Bevy_dolly's API is still being revised, so feedback on ergonomics and DX is highly appreciated

It is important to note that dolly is a way to control the movement of the camera and thus, not the camera component itself.

Dolly requires two steps to function:

  1. Creating a Rig we are able to define drivers on which the dolly can enact, these drivers can both be constraints and functionality.
  2. A marker component that is registered on both the Camera and the Rig.

What are drivers?

Explain what drivers are

To read more about the different drivers.

#[derive(Component)]
struct MainCamera;

fn main() {
  App::new()
    .add_plugins(DefaultPlugins)
    .add_startup_system(setup)
    //..
    .add_system(Dolly::<MainCamera>::update_active)
    //..
    .run();
}
// In your setup system
fn setup(
  mut commands: Commands,
) {
  commands.spawn((
    MainCamera, // The rig tag
    Rig::builder()
      .with(Position::new(Vec3::ZERO))
      .with(YawPitch::new().yaw_degrees(45.0).pitch_degrees(-30.0))
      .with(Smooth::new_position(0.3))
      .with(Smooth::new_rotation(0.3))
      .with(Arm::new(Vec3::Z * 4.0))
      .build(),
    Camera3dBundle::default(),
  ));
}

Link to examples readme

Helpers

This plugin is currently also provides some helper plugins, which. They enabled by default but is not needed and can be removed when setting up bevy_dolly's dependency:

[dependencies]
bevy_dolly = { git = "https://github.com/BlackPhlox/bevy_dolly", default-features = false }

Note this will also remove the bevy_dolly's extended drivers add features = ["drivers"], to include the drivers back.

Examples

To see how works in bevy in practice, please look at this repository's examples.

Something about usages...

Reference

How to run

cargo run --release --example orbit

Support

Bevy tracking

bevy bevy_dolly
0.10 0.0.1

Alternatives

There is a bunch of other bevy camera controllers that are worth checking out, especially if you are just starting out learning bevy:

Licensing

The project is under dual license MIT and Apache 2.0, so joink to your hearts content, just remember the license agreements.

Contributing

Yes this project is still very much WIP, so PRs are very welcome.
The dolly dependency used is a slightly patched submodule, so to build the crate locally you must first run the following:

git submodule update --init --recursive