Skip to content

Commit

Permalink
Updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackPhlox committed Dec 3, 2023
1 parent 49a04ca commit eaadc37
Showing 1 changed file with 64 additions and 42 deletions.
106 changes: 64 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,42 @@
</div>
</br>

`bevy_dolly` is a prototype plugin using [h3r2tic](https://github.com/h3r2tic)'s powerful crate: [dolly](https://github.com/h3r2tic/dolly), implemented for bevy.
# Improving `bevy_dolly` Documentation

**Feedback** - _Bevy_dolly's API is still being revised, so feedback on ergonomics and DX is highly appreciated_
## Overview

It is important to note that dolly is a way to control the movement of the camera and thus, not the camera component itself. </br>
`bevy_dolly` is a prototype plugin built for the [Bevy](https://github.com/bevyengine/bevy) game engine. It leverages the powerful `dolly` crate, developed by [h3r2tic](https://github.com/h3r2tic), to control camera movement within a Bevy application.

Dolly requires two steps to function:
> [!WARNING]
> Be aware that `bevy_dolly`'s API is still undergoing revisions. Feedback on its ergonomics and developer experience (DX) is highly appreciated.
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.
## Dolly and Camera Movement

## What are drivers?
It's important to know that `dolly` is all about controlling how the camera moves and not changing the camera itself. This means you can use it for other things, like making a turret and its cannon move around.

Explain what drivers are
Dolly operates in two essential steps:

To read more about the different drivers.
1. **Creating a Rig**: Define a `Rig` with drivers that the dolly can utilize. These drivers, which can control both translation, rotation, constraints and custom behavior as abstractions. These rigs serve as tools to shape the camera's behavior and provide additional functionality.

```rs
2. **Marker Component**: Register a marker component on both the Camera and the Rig (rig component tag). This allows you to easily switch the behavior of a camera entity by changing the associated rig component tag. To understand the process better, refer to the [examples](#example-showcase).

## Understanding Drivers

Drivers are mechanisms that influence the behavior of the camera. They can represent constraints or provide additional functionality. To explore the available drivers, refer to the [examples](example-showcase).

In your `Cargo.toml`:

```toml
[dependencies]
# Your bevy dependency here ...
# bevy = "0.12"
bevy_dolly = { version = "0.0.2" }
```

In your Bevy App:

```rust
// The component tag used to parent to a Dolly Rig
#[derive(Component)]
struct MainCamera;

Expand All @@ -54,76 +72,80 @@ fn main() {
}
```

```rs
In the setup system:

```rust
// In your setup system
fn setup(
mut commands: Commands,
) {
commands.spawn((
MainCamera, // The rig tag
Rig::builder()
MainCamera, // The rig component tag
Rig::builder() // The rig itself
.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(),
Camera3dBundle::default(), // The camera which is related via the rig tag
));
}
```

Link to [examples readme](/examples/README.md)
## Helper Plugins

## 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:
`bevy_dolly` provides some helper plugins by default, which can be removed if not needed when setting up `bevy_dolly` as a dependency:

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

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

## Examples
## Example Showcase

To see how works in Bevy in practice, please look at this repository's [examples](/examples/).
Explore practical examples in the [examples repository](/examples/README.md).

### How to run
### Running Examples

`cargo run --release --example orbit`
If you've cloned the project and want to test, execute the following command to run the `orbit` example:

## Support
```bash
cargo run --release --example orbit
```

[![Bevy tracking](https://img.shields.io/badge/Bevy%20tracking-released%20version-lightblue)](https://github.com/bevyengine/bevy/blob/main/docs/plugins_guidelines.md#main-branch-tracking)
## Compatibility and Support

|bevy|bevy_dolly|
|---|---|
|0.11| 0.0.1 |
|0.12|0.0.2|
|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:
Explore other Bevy camera controllers that might suit your needs:

- [bevy_fps_controller](https://github.com/qhdwight/bevy_fps_controller) - A Fps controller with crouching, sprinting, flymode and more
- [smooth-bevy-cameras](https://github.com/bonsairobo/smooth-bevy-cameras) - 3 Smooth Camera controllers: Fps, Orbit or Unreal
- [bevy_spectator](https://github.com/JonahPlusPlus/bevy_spectator) - A spectator camera controller
- [bevy_flycam](https://github.com/sburris0/bevy_flycam) - A simple fly camera
- [bevy_fly_camera](https://github.com/mcpar-land/bevy_fly_camera) - A advanced fly camera
- [bevy_pancam](https://github.com/johanhelsing/bevy_pancam) - 2D Click and Drag - Style camera movement
- [bevy_config_cam](https://github.com/BlackPhlox/bevy_config_cam) - Plugin that enables to use collection of different camera controllers at runtime, uses bevy_dolly as the backend
- [bevy_fps_controller](https://github.com/qhdwight/bevy_fps_controller)
- [smooth-bevy-cameras](https://github.com/bonsairobo/smooth-bevy-cameras)
- [bevy_spectator](https://github.com/JonahPlusPlus/bevy_spectator)
- [bevy_flycam](https://github.com/sburris0/bevy_flycam)
- [bevy_fly_camera](https://github.com/mcpar-land/bevy_fly_camera)
- [bevy_pancam](https://github.com/johanhelsing/bevy_pancam)
- [bevy_config_cam](https://github.com/BlackPhlox/bevy_config_cam)

## Licensing

The project is under dual license MIT and Apache 2.0, so joink to your hearts content, just remember the license agreements.
The project is under a dual license: MIT and Apache 2.0. Feel free to contribute within the bounds of these licenses.

## 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:
Yes this project is still a WIP, so PRs are very welcome.

```bash
git submodule update --init --recursive
```
> [!NOTE]
> Note that the `dolly` dependency used is a slightly patched submodule to allow for native bevy transform types. To build the crate locally, run:
>
> ```bash
> git submodule update --init --recursive
> ```

0 comments on commit eaadc37

Please sign in to comment.