diff --git a/src/body.rs b/src/body.rs index 2658ae4..5e22f15 100644 --- a/src/body.rs +++ b/src/body.rs @@ -642,8 +642,8 @@ impl crate::instruction::InstructionConsumer for PhysicsStat match ins.instruction { PhysicsInstruction::CollisionStart(c) => { //flatten v - let n=c.normal(&self.models_cringe_clone).normalize(); - let d=self.body.velocity.dot(n); + let n=c.normal(&self.models_cringe_clone); + let d=self.body.velocity.dot(n)/n.length_squared(); self.body.velocity-=d*n; //check ground match c.face { diff --git a/src/main.rs b/src/main.rs index 211ebbb..c6c35ad 100644 --- a/src/main.rs +++ b/src/main.rs @@ -292,7 +292,7 @@ impl strafe_client::framework::Example for Skybox { controls:0, }; let physics = strafe_client::body::PhysicsState { - body: strafe_client::body::Body::with_position(glam::Vec3::new(5.0,5.0,5.0)), + body: strafe_client::body::Body::with_position(glam::Vec3::new(5.0,2.0,5.0)), time: 0, tick: 0, strafe_tick_num: 100,//100t