forked from StrafesNET/strafe-client
tabs
This commit is contained in:
parent
f60a370228
commit
4c079068d6
40
src/body.rs
40
src/body.rs
@ -23,10 +23,10 @@ pub struct Body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub enum MoveRestriction {
|
pub enum MoveRestriction {
|
||||||
Air,
|
Air,
|
||||||
Water,
|
Water,
|
||||||
Ground,
|
Ground,
|
||||||
Ladder,//multiple ladders how
|
Ladder,//multiple ladders how
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct PhysicsState {
|
pub struct PhysicsState {
|
||||||
@ -312,27 +312,27 @@ impl crate::instruction::InstructionConsumer<PhysicsInstruction> for PhysicsStat
|
|||||||
//mutate position and velocity and time
|
//mutate position and velocity and time
|
||||||
self.advance_time(ins.time);//should this be in run?
|
self.advance_time(ins.time);//should this be in run?
|
||||||
match ins.instruction {
|
match ins.instruction {
|
||||||
PhysicsInstruction::CollisionStart(_) => todo!(),
|
PhysicsInstruction::CollisionStart(_) => todo!(),
|
||||||
PhysicsInstruction::CollisionEnd(_) => todo!(),
|
PhysicsInstruction::CollisionEnd(_) => todo!(),
|
||||||
PhysicsInstruction::StrafeTick => {
|
PhysicsInstruction::StrafeTick => {
|
||||||
//let control_dir=self.get_control_dir();//this should respect your mouse interpolation settings
|
//let control_dir=self.get_control_dir();//this should respect your mouse interpolation settings
|
||||||
let d=self.body.velocity.dot(self.temp_control_dir);
|
let d=self.body.velocity.dot(self.temp_control_dir);
|
||||||
if d<self.mv {
|
if d<self.mv {
|
||||||
self.body.velocity+=(self.mv-d)*self.temp_control_dir;
|
self.body.velocity+=(self.mv-d)*self.temp_control_dir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PhysicsInstruction::Jump => {
|
PhysicsInstruction::Jump => {
|
||||||
self.grounded=false;//do I need this?
|
self.grounded=false;//do I need this?
|
||||||
self.body.velocity+=glam::Vec3::new(0.0,0.715588/2.0*100.0,0.0);
|
self.body.velocity+=glam::Vec3::new(0.0,0.715588/2.0*100.0,0.0);
|
||||||
}
|
}
|
||||||
PhysicsInstruction::ReachWalkTargetVelocity => {
|
PhysicsInstruction::ReachWalkTargetVelocity => {
|
||||||
//precisely set velocity
|
//precisely set velocity
|
||||||
self.body.velocity=self.walk_target_velocity;
|
self.body.velocity=self.walk_target_velocity;
|
||||||
}
|
}
|
||||||
PhysicsInstruction::SetWalkTargetVelocity(v) => {
|
PhysicsInstruction::SetWalkTargetVelocity(v) => {
|
||||||
self.walk_target_velocity=v;
|
self.walk_target_velocity=v;
|
||||||
//calculate acceleration yada yada
|
//calculate acceleration yada yada
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user