Skip to content

Commit

Permalink
Merge pull request #33 from toolness/patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackPhlox committed Jul 16, 2023
2 parents 4aa8de3 + a237a47 commit db494ee
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ There are a few notable differences from [bevy_fly_camera](https://github.com/mc
use bevy_flycam::prelude::*;
```

This will spawn a camera for you.
Use `NoCameraPlayerPlugin` if you do not want this and make sure to use `.insert(FlyCam)` on your own camera or else this plugin won't know what to move.

3. Add the `PlayerPlugin`:

```rust
Expand All @@ -62,11 +59,16 @@ There are a few notable differences from [bevy_fly_camera](https://github.com/mc
}
```

Note that `PlayerPlugin` will spawn a camera for you. See [Using your own camera](#using-your-own-camera) for details on how to
use a pre-existing one.

Alternatively you can see the example `basic.rs` or `scroll.rs` located in the examples folder.
You can run the example by cloning this repository and run the command: `cargo run --release --example basic`

## Customization

### Movement and keybindings

To modify player movement speed or mouse sensitivity add it as a resource. </br>
Same thing goes for the keybindings used for moving the camera.

Expand All @@ -89,6 +91,31 @@ fn main() {
}
```

### Using your own camera

You can also use `NoCameraPlayerPlugin` if you want to use your own camera. Be sure to add the `FlyCam` component to your own camera or else this plugin won't know what to move.

```Rust
#[bevy_main]
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(NoCameraPlayerPlugin)
.add_startup_system(setup)
.run();
}

fn setup(mut commands: Commands) {
commands.spawn((
Camera3dBundle {
transform: Transform::from_xyz(0.0, 2.0, 0.5),
..default()
},
FlyCam
));
}
```

## Support

[![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)
Expand Down

0 comments on commit db494ee

Please sign in to comment.