Skip to content
Merged
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
175 changes: 122 additions & 53 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ bevy_asset = "0.17.3"
bevy_camera = "0.17.3"
bevy_mesh = "0.17.3"
bevy_dev_tools = "0.17.3"
bevy_fps_controller = {version = "17.1.0", features = ["rapier"]}
bevy_rapier3d = {version ="0.32"}
bevy_fps_controller = {version = "17.1.0", features = ["avian"]}
avian3d = {version="0.4", features = ["debug-plugin"]}
bevy_flair = "0.6.0"
bevy_egui = { version = "0.38.1", features = ["immutable_ctx"]}
bevy_diagnostic = "0.17.3"
Expand Down Expand Up @@ -51,6 +51,9 @@ opt-level = 3

[profile.release]
opt-level = 3
lto = "thin"
codegen-units = 1
strip = true

[[bin]]
name = "client"
Expand Down
7 changes: 4 additions & 3 deletions src/client/collider/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ pub fn setup_coliders_system(mut commands: Commands) {
for z in collider_range.clone() {
commands
.spawn((
RigidBody::Static,
Collider::cuboid(
COLLIDER_CUBOID_WIDTH / 2.0,
COLLIDER_CUBOID_WIDTH / 2.0,
COLLIDER_CUBOID_WIDTH / 2.0,
COLLIDER_CUBOID_WIDTH,
COLLIDER_CUBOID_WIDTH,
COLLIDER_CUBOID_WIDTH,
),
Transform::from_xyz(x as f32, y as f32, z as f32),
))
Expand Down
2 changes: 1 addition & 1 deletion src/client/gui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl Plugin for GuiPlugin {
..default()
},
text_color: Color::srgb(0.0, 1.0, 0.0),
refresh_interval: core::time::Duration::from_millis(10),
refresh_interval: core::time::Duration::from_millis(200),
enabled: true,
frame_time_graph_config: FrameTimeGraphConfig {
enabled: true,
Expand Down
5 changes: 3 additions & 2 deletions src/client/player/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pub mod resources;
pub mod systems;

use crate::prelude::*;
use avian3d::PhysicsPlugins;

pub struct PlayerPlugin;

Expand All @@ -12,9 +13,9 @@ impl Plugin for PlayerPlugin {
debug!("Building PlayerPlugin");
info!("Building PlayerPlugin");
app.add_plugins(FpsControllerPlugin);
app.add_plugins(RapierPhysicsPlugin::<NoUserData>::default());
app.add_plugins(PhysicsPlugins::default());
#[cfg(feature = "physics_debug")]
app.add_plugins(RapierDebugRenderPlugin::default());
app.add_plugins(PhysicsDebugPlugin::default());
app.add_message::<player_events::PlayerColliderUpdateEvent>();
app.insert_resource(player_resources::BlockSelection::new());
app.insert_resource(player_resources::PlayerSpawned(false));
Expand Down
20 changes: 10 additions & 10 deletions src/client/player/systems/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,24 @@ pub fn setup_controller_on_area_ready_system(

let logical_entity = commands
.spawn((
Collider::capsule(Vec3::Y * 0.5, Vec3::Y * 1.5, 0.5),
Collider::cylinder(0.25, 1.5),
Friction {
coefficient: 0.0,
combine_rule: CoefficientCombineRule::Min,
dynamic_coefficient: 0.0,
static_coefficient: 0.0,
combine_rule: CoefficientCombine::Min,
},
Restitution {
coefficient: 0.0,
combine_rule: CoefficientCombineRule::Min,
combine_rule: CoefficientCombine::Min,
},
ActiveEvents::COLLISION_EVENTS,
Velocity::zero(),
LinearVelocity::ZERO,
#[cfg(feature = "lock_player")]
RigidBody::Fixed,
RigidBody::Static,
#[cfg(not(feature = "lock_player"))]
RigidBody::Dynamic,
Sleeping::disabled(),
LockedAxes::ROTATION_LOCKED,
AdditionalMassProperties::Mass(1.0),
Mass(1.0),
GravityScale(0.0),
Ccd { enabled: true },
Transform::from_translation(spawn_position),
LogicalPlayer,
#[cfg(not(feature = "lock_player"))]
Expand All @@ -79,6 +77,8 @@ pub fn setup_controller_on_area_ready_system(
crouch_height: 1.2,
air_acceleration: 80.0,
radius: 0.75,
experimental_step_offset: 0.1,
experimental_enable_ledge_cling: true,
..default()
},
))
Expand Down
Loading