Made building with dynamic linking (mold + clang) optional, testing code's framerate dependency
This commit is contained in:
parent
68c30e369d
commit
d20f208bf7
5 changed files with 29 additions and 12 deletions
9
.vscode/launch.json
vendored
9
.vscode/launch.json
vendored
|
|
@ -12,7 +12,14 @@
|
|||
"name": "Build and Run program",
|
||||
"request": "launch",
|
||||
"type": "node-terminal"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command": "nix-shell --run 'cargo run --features bevy/dynamic_linking'",
|
||||
"name": "Mold build and run program",
|
||||
"request": "launch",
|
||||
"type": "node-terminal"
|
||||
},
|
||||
|
||||
],
|
||||
"compounds": []
|
||||
}
|
||||
|
|
|
|||
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -313,7 +313,6 @@ version = "0.13.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea370412c322af887c9115442d8f2ec991b652f163a1d8920ecaf08cae63f2bc"
|
||||
dependencies = [
|
||||
"bevy_dylib",
|
||||
"bevy_internal",
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ opt-level = 3
|
|||
|
||||
|
||||
[dependencies]
|
||||
bevy = { version = "0.13.1", features = ["wayland", "dynamic_linking"]}
|
||||
bevy = { version = "0.13.1", features = ["wayland"]}
|
||||
bevy_dylib = "0.13.1"
|
||||
bevy_editor_pls = "0.8.1"
|
||||
bevy_xpbd_3d = {git = "https://git.opencodebox.com/MikolajG/bevy_xpbd", branch = "reflect-serialize"}
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ pub struct CharacterControllerPlugin;
|
|||
impl Plugin for CharacterControllerPlugin{
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_systems(Update,(
|
||||
update_grounded,
|
||||
keyboard_input,
|
||||
move_character,
|
||||
dampen_movement)
|
||||
)
|
||||
);
|
||||
app.add_systems(FixedUpdate, (move_character,
|
||||
dampen_movement,update_grounded));
|
||||
app.add_event::<MovementAction>();
|
||||
}
|
||||
}
|
||||
|
|
@ -164,16 +164,16 @@ pub fn move_character(
|
|||
let angle = rotation.rotate(-hit.normal2).angle_between(Vector::Y).abs();
|
||||
if angle <= character_controller.max_slope_angle {
|
||||
slope_factor *= (angle / character_controller.max_slope_angle).cos();
|
||||
velocity.x += direction.x * character_controller.movement_acceleration * slope_factor * delta_time;
|
||||
velocity.z -= direction.y * character_controller.movement_acceleration * slope_factor * delta_time;
|
||||
} else {
|
||||
velocity.x = 0.0;
|
||||
velocity.z = 0.0;
|
||||
}
|
||||
}
|
||||
velocity.x += direction.x * character_controller.movement_acceleration * delta_time * slope_factor;
|
||||
velocity.z -= direction.y * character_controller.movement_acceleration * delta_time * slope_factor;
|
||||
} else {
|
||||
velocity.x += direction.x * character_controller.movement_acceleration * delta_time * character_controller.air_control_factor;
|
||||
velocity.z -= direction.y * character_controller.movement_acceleration * delta_time * character_controller.air_control_factor;
|
||||
velocity.x += direction.x * character_controller.movement_acceleration * character_controller.air_control_factor * delta_time ;
|
||||
velocity.z -= direction.y * character_controller.movement_acceleration * character_controller.air_control_factor * delta_time ;
|
||||
}
|
||||
}
|
||||
MovementAction::Jump => {
|
||||
|
|
|
|||
15
src/main.rs
15
src/main.rs
|
|
@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use bevy::prelude::*;
|
||||
use bevy::{diagnostic::FrameTimeDiagnosticsPlugin, prelude::*, window::Cursor};
|
||||
use bevy_xpbd_3d::prelude::*;
|
||||
use bevy_editor_pls::prelude::*;
|
||||
mod charcacter_controller;
|
||||
|
|
@ -26,9 +26,20 @@ fn main() {
|
|||
|
||||
app
|
||||
.add_plugins((
|
||||
DefaultPlugins,
|
||||
DefaultPlugins.set(WindowPlugin {
|
||||
primary_window: Some(Window {
|
||||
cursor: Cursor::default(),
|
||||
present_mode: bevy::window::PresentMode::AutoNoVsync,
|
||||
mode: bevy::window::WindowMode::Windowed,
|
||||
title: "Trouble in Terror Town: Community Edition".to_string(),
|
||||
resizable: true,
|
||||
..default()
|
||||
}),
|
||||
..default()
|
||||
}),
|
||||
PhysicsPlugins::default(),
|
||||
EditorPlugin::default(),
|
||||
FrameTimeDiagnosticsPlugin::default(),
|
||||
CharacterControllerPlugin,
|
||||
))
|
||||
.add_systems(Startup, setup)
|
||||
|
|
|
|||
Loading…
Reference in a new issue