Crates.io | bevy_fps_controller |
lib.rs | bevy_fps_controller |
version | |
source | src |
created_at | 2022-08-08 19:35:19.567813 |
updated_at | 2024-12-11 07:32:57.523654 |
description | Bevy plugin that adds a Source engine inspired FPS movement controller |
homepage | |
repository | https://github.com/qhdwight/bevy_fps_controller |
max_upload_size | |
id | 641008 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Inspired from Source engine movement, this plugin implements movement suitable for FPS games.
Feel free to make issues/PRs!
See main.rs
cargo run --release --example minimal
use bevy::prelude::*;
use bevy_rapier3d::prelude::*;
use bevy_fps_controller::controller::*;
fn main() {
App::new()
...
.add_plugin(RapierPhysicsPlugin::<NoUserData>::default())
.add_plugin(FpsControllerPlugin)
.add_startup_system(setup)
...
}
fn setup(mut commands: Commands, ...) {
...
let logical_entity = commands
.spawn((
Collider::capsule_y(1.0, 0.5),
Friction {
coefficient: 0.0,
combine_rule: CoefficientCombineRule::Min,
},
Restitution {
coefficient: 0.0,
combine_rule: CoefficientCombineRule::Min,
},
ActiveEvents::COLLISION_EVENTS,
Velocity::zero(),
RigidBody::Dynamic,
Sleeping::disabled(),
LockedAxes::ROTATION_LOCKED,
AdditionalMassProperties::Mass(1.0),
GravityScale(0.0),
Ccd { enabled: true }, // Prevent clipping when going fast
TransformBundle::from_transform(Transform::from_xyz(0.0, 3.0, 0.0)),
LogicalPlayer,
FpsControllerInput {
pitch: -TAU / 12.0,
yaw: TAU * 5.0 / 8.0,
..default()
},
FpsController { ..default() }
))
.insert(CameraConfig {
height_offset: -0.5,
})
.id();
commands.spawn((
Camera3dBundle::default(),
RenderPlayer { logical_entity },
));
...
}
Used by my other project: https://github.com/qhdwight/voxel-game-rs