Skip to content

h3r2tic's dolly abstraction layer for the bevy game framework

License

Notifications You must be signed in to change notification settings

ProjectKML/bevy_dolly

 
 

Repository files navigation

bevy_dolly

Static Pinned
bevy dolly static bevy dolly pinned
link to crates.io link to docs.rs link to license downloads/link to crates.io stars/github repo github actions tracking bevy release branch

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 currently also provides some helper plugins, which. They are enabled by default but are not needed and can be removed when setting up bevy_dolly's dependency:

[dependencies]
bevy_dolly = { version = "0.0.1", default-features = false }

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

Examples

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

How to run

cargo run --release --example orbit

Support

Bevy tracking

bevy bevy_dolly
0.11 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

About

h3r2tic's dolly abstraction layer for the bevy game framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%