MASSIVE Kinematic Character Controller Update
- NEW kinematic character controller powered by rapier3d at kinematic_character_controller.rs - NEW camera modes. The ability to switch between the free debug camera and new character controller. - NEW keybinds system to support the camera mode swap
This commit is contained in:
parent
db1b427e2a
commit
f503c70a9b
12 changed files with 323 additions and 26 deletions
|
|
@ -6,20 +6,22 @@ use raidillon_engine::system::System;
|
|||
use raidillon_physics::Physics;
|
||||
use raidillon_platform::PlatformContext;
|
||||
|
||||
/// Do physics calculations and apply to world.
|
||||
#[derive(Default)]
|
||||
pub struct PhysicsSystem;
|
||||
|
||||
impl System for PhysicsSystem {
|
||||
fn load_world(&mut self, res: &mut EngineResources, scene: &mut Scene) {
|
||||
let p = Physics::default();
|
||||
res.insert(p);
|
||||
scene.resources.insert(p);
|
||||
}
|
||||
|
||||
fn fixed_update(&mut self, res: &mut EngineResources, scene: &mut Scene) {
|
||||
let pctx = res.get::<PlatformContext>().expect("PlatformContext missing").clone();
|
||||
let physics = res.get_mut::<Physics>().expect("Physics missing");
|
||||
let physics = scene.resources.get_mut::<Physics>().expect("Physics missing");
|
||||
physics.step(pctx.time_ctx.fixed_dt);
|
||||
|
||||
// apply calculations to dynamic bodies
|
||||
let mut query = scene.world.query::<(&mut Transform, &RigidBodyComponent)>();
|
||||
for (_ent, (tr, rb_component)) in query.iter() {
|
||||
if let Some(body) = physics.get_rigid_body(rb_component.0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue