Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_fps_controller"
version = "16.1.0"
version = "17.0.0"
edition = "2021"
authors = ["bevy_fps_controller"]
repository = "https://github.com/qhdwight/bevy_fps_controller"
Expand All @@ -10,9 +10,9 @@ readme = "README.md"
description = "Bevy plugin that adds a Source engine inspired FPS movement controller"

[dependencies]
bevy = "0.16"
bevy_rapier3d = { version = "0.31", optional = true }
avian3d = { version = "0.3", optional = true }
bevy = "0.17"
bevy_rapier3d = { version = "0.31", optional = true, git = "https://github.com/Deniskore/bevy_rapier.git", branch = "bevy-0.17" }
avian3d = { version = "0.4", optional = true }

[features]
default = []
Expand Down
14 changes: 7 additions & 7 deletions examples/minimal_avian.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ use std::f32::consts::TAU;

use avian3d::prelude::*;
use bevy::{
camera::Exposure,
gltf::{Gltf, GltfMesh, GltfNode},
math::Vec3Swizzles,
prelude::*,
render::camera::Exposure,
window::CursorGrabMode,
window::{CursorGrabMode, CursorOptions},
};

use bevy_fps_controller::controller::*;
Expand Down Expand Up @@ -70,7 +70,6 @@ fn setup(mut commands: Commands, mut window: Query<&mut Window>, assets: Res<Ass
},
LinearVelocity::ZERO,
RigidBody::Dynamic,
Sleeping,
LockedAxes::ROTATION_LOCKED,
Mass(1.0),
GravityScale(0.0),
Expand Down Expand Up @@ -179,19 +178,20 @@ fn manage_cursor(
btn: Res<ButtonInput<MouseButton>>,
key: Res<ButtonInput<KeyCode>>,
mut window_query: Query<&mut Window>,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

window_query is now unused

mut cursor: Single<&mut CursorOptions>,
mut controller_query: Query<&mut FpsController>,
) {
for mut window in &mut window_query {
if btn.just_pressed(MouseButton::Left) {
window.cursor_options.grab_mode = CursorGrabMode::Locked;
window.cursor_options.visible = false;
cursor.grab_mode = CursorGrabMode::Locked;
cursor.visible = false;
for mut controller in &mut controller_query {
controller.enable_input = true;
}
}
if key.just_pressed(KeyCode::Escape) {
window.cursor_options.grab_mode = CursorGrabMode::None;
window.cursor_options.visible = true;
cursor.grab_mode = CursorGrabMode::None;
cursor.visible = true;
for mut controller in &mut controller_query {
controller.enable_input = false;
}
Expand Down
13 changes: 7 additions & 6 deletions examples/minimal_rapier.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::f32::consts::TAU;

use bevy::{
camera::Exposure,
gltf::{Gltf, GltfMesh, GltfNode},
math::Vec3Swizzles,
prelude::*,
render::camera::Exposure,
window::CursorGrabMode,
window::{CursorGrabMode, CursorOptions},
};
use bevy_rapier3d::prelude::*;

Expand Down Expand Up @@ -184,19 +184,20 @@ fn manage_cursor(
btn: Res<ButtonInput<MouseButton>>,
key: Res<ButtonInput<KeyCode>>,
mut window_query: Query<&mut Window>,
mut cursor: Single<&mut CursorOptions>,
mut controller_query: Query<&mut FpsController>,
) {
for mut window in &mut window_query {
if btn.just_pressed(MouseButton::Left) {
window.cursor_options.grab_mode = CursorGrabMode::Locked;
window.cursor_options.visible = false;
cursor.grab_mode = CursorGrabMode::Locked;
cursor.visible = false;
for mut controller in &mut controller_query {
controller.enable_input = true;
}
}
if key.just_pressed(KeyCode::Escape) {
window.cursor_options.grab_mode = CursorGrabMode::None;
window.cursor_options.visible = true;
cursor.grab_mode = CursorGrabMode::None;
cursor.visible = true;
for mut controller in &mut controller_query {
controller.enable_input = false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/controller_avian.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ const SLIGHT_SCALE_DOWN: f32 = 0.9375;

pub fn fps_controller_input(
key_input: Res<ButtonInput<KeyCode>>,
mut mouse_events: EventReader<MouseMotion>,
mut mouse_events: MessageReader<MouseMotion>,
mut query: Query<(&FpsController, &mut FpsControllerInput)>,
) {
for (controller, mut input) in query
Expand Down
2 changes: 1 addition & 1 deletion src/controller_rapier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ const SLIGHT_SCALE_DOWN: f32 = 0.9375;

pub fn fps_controller_input(
key_input: Res<ButtonInput<KeyCode>>,
mut mouse_events: EventReader<MouseMotion>,
mut mouse_events: MessageReader<MouseMotion>,
mut query: Query<(&FpsController, &mut FpsControllerInput)>,
) {
for (controller, mut input) in query
Expand Down