Skip to content

Commit

Permalink
Merge pull request #31 from BlackPhlox/no_player_plugin_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackPhlox committed Apr 10, 2023
2 parents 68eafb4 + c3e57a0 commit 680247f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "bevy_flycam"
version = "0.10.0"
version = "0.10.1"
authors = ["Spencer Burris <sburris@posteo.net>"]
edition = "2021"
license = "ISC"
Expand Down
67 changes: 39 additions & 28 deletions README.md
@@ -1,18 +1,20 @@
# bevy_flycam

[![Crates.io](https://img.shields.io/crates/v/bevy_flycam)](https://crates.io/crates/bevy_flycam)
![Crates.io](https://img.shields.io/crates/l/bevy_flycam)
![docs.rs](https://img.shields.io/docsrs/bevy_flycam)


A basic first-person fly camera for Bevy 0.10

## Controls

* WASD to move horizontally
* SPACE to ascend
* LSHIFT to descend
* ESC to grab/release cursor.

## Comparison

There are a few notable differences from [bevy_fly_camera](https://github.com/mcpar-land/bevy_fly_camera)...

* No linear interpolation
Expand All @@ -22,45 +24,52 @@ There are a few notable differences from [bevy_fly_camera](https://github.com/mc
* A tiny bit faster?

## Usage

1. Add to `Cargo.toml` or copy `lib.rs` to your own file
```toml
[dependencies]
bevy = "0.10"
bevy_flycam = "*"
```

or
```toml
[dependencies]
bevy = "0.10"
bevy_flycam = "*"
```

```toml
[dependencies]
bevy = "0.10"
bevy_flycam = { git = "https://github.com/sburris0/bevy_flycam" }
```
or

```toml
[dependencies]
bevy = "0.10"
bevy_flycam = { git = "https://github.com/sburris0/bevy_flycam" }
```

2. Include the prelude:
```rust
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.

```rust
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
#[bevy_main]
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(PlayerPlugin)
.run();
}
```

```rust
#[bevy_main]
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(PlayerPlugin)
.run();
}
```

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

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.

```Rust
#[bevy_main]
fn main() {
Expand All @@ -80,13 +89,15 @@ fn main() {
}
```

# Support
## 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)

bevy_flycam's crate version follows bevy's minor version as shown:
| bevy | bevy_flycam |
| :-- | :-- |
| `0.10.X` | `0.10` |
| `0.10.1` | `0.10.1` |

## Contributing

PRs are very welcome.
1 change: 1 addition & 0 deletions src/lib.rs
Expand Up @@ -227,6 +227,7 @@ impl Plugin for NoCameraPlayerPlugin {
app.init_resource::<InputState>()
.init_resource::<MovementSettings>()
.init_resource::<KeyBindings>()
.add_system(initial_grab_cursor.on_startup())
.add_system(initial_grab_on_flycam_spawn.on_startup())
.add_system(player_move)
.add_system(player_look)
Expand Down

0 comments on commit 680247f

Please sign in to comment.