I need to rethink Collision vs Attributes

This commit is contained in:
Quaternions 2023-11-01 16:57:49 -07:00
parent 49931a40fc
commit b897d4a662

View File

@ -1085,15 +1085,15 @@ fn run_teleport_behaviour(teleport_behaviour:&Option<crate::model::TeleportBehav
impl crate::instruction::InstructionConsumer<PhysicsInstruction> for PhysicsState { impl crate::instruction::InstructionConsumer<PhysicsInstruction> for PhysicsState {
fn process_instruction(&mut self, ins:TimedInstruction<PhysicsInstruction>) { fn process_instruction(&mut self, ins:TimedInstruction<PhysicsInstruction>) {
match &ins.instruction { match &ins.instruction{
PhysicsInstruction::Input(PhysicsInputInstruction::Idle) PhysicsInstruction::Input(PhysicsInputInstruction::Idle)
|PhysicsInstruction::Input(PhysicsInputInstruction::SetNextMouse(_)) |PhysicsInstruction::Input(PhysicsInputInstruction::SetNextMouse(_))
|PhysicsInstruction::Input(PhysicsInputInstruction::ReplaceMouse(_,_)) |PhysicsInstruction::Input(PhysicsInputInstruction::ReplaceMouse(_,_))
|PhysicsInstruction::StrafeTick => (), |PhysicsInstruction::StrafeTick=>(),
_=>println!("{}|{:?}",ins.time,ins.instruction), _=>println!("{}|{:?}",ins.time,ins.instruction),
} }
//selectively update body //selectively update body
match &ins.instruction { match &ins.instruction{
PhysicsInstruction::Input(PhysicsInputInstruction::Idle)=>self.time=ins.time,//idle simply updates time PhysicsInstruction::Input(PhysicsInputInstruction::Idle)=>self.time=ins.time,//idle simply updates time
PhysicsInstruction::Input(_) PhysicsInstruction::Input(_)
|PhysicsInstruction::ReachWalkTargetVelocity |PhysicsInstruction::ReachWalkTargetVelocity
@ -1101,10 +1101,9 @@ impl crate::instruction::InstructionConsumer<PhysicsInstruction> for PhysicsStat
|PhysicsInstruction::CollisionEnd(_) |PhysicsInstruction::CollisionEnd(_)
|PhysicsInstruction::StrafeTick=>self.advance_time(ins.time), |PhysicsInstruction::StrafeTick=>self.advance_time(ins.time),
} }
match ins.instruction { match ins.instruction{
PhysicsInstruction::CollisionStart(c) => { PhysicsInstruction::CollisionStart(c)=>{
let model=c.model(&self.models).unwrap(); match self.models.attr(c.model_id()){
match &model.attributes{
PhysicsCollisionAttributes::Contact{contacting,general}=>{ PhysicsCollisionAttributes::Contact{contacting,general}=>{
let mut v=self.body.velocity; let mut v=self.body.velocity;
match &contacting.contact_behaviour{ match &contacting.contact_behaviour{