bevy-fpscam

Crates.iobevy-fpscam
lib.rsbevy-fpscam
version0.7.0
sourcesrc
created_at2022-06-06 18:38:30.483428
updated_at2022-06-06 18:38:30.483428
descriptionA basic fps-style camera for bevy
homepage
repositoryhttps://github.com/u296/bevy-fpscam
max_upload_size
id600906
size11,005
(u296)

documentation

README

A basic fps-style flycamera for bevy

Controls

  • WASD to move
  • LCTRL to descend
  • Space to ascend
  • Escape to unlock cursor

The controls are customizable

Usage

  1. Add to Cargo.toml, matching major/minor with bevy
[dependencies]
bevy = "X.Y"
bevy-fpscam = "X.Y"
  1. Use the plugin
use bevy_fpscam::FpsCamPlugin;

This will spawn the camera for you. If you want to create the camera yourself, use NoSpawnFpsCamPlugin instead, and add a FpsCam component to your camera.

  1. Add the plugin
fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugin(FpsCamPlugin)
        .run();     
}

Customization

You can modify mouse sensitivity, movement speed and keybindings by modifying the resource of type bevy_fpscam::Config

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugin(FpsCamPlugin)
        .insert_resource(bevy_fpscam::Config{
            movespeed: 2.0,
            sensitivity: 0.01,
            key_bindings: KeyBindings {
                unlock: Some(KeyCode::Enter),
                ..Default::default()
        }}).run();
}
Commit count: 1

cargo fmt