spawn_point is part of building

This commit is contained in:
Quaternions 2023-10-04 15:34:52 -07:00
parent bd6cd5eacc
commit f2e4286a08
2 changed files with 1 additions and 10 deletions

View File

@ -14,8 +14,6 @@ pub enum PhysicsInstruction {
// ) // )
//InputInstructions conditionally activate RefreshWalkTarget (by doing what SetWalkTargetVelocity used to do and then flagging it) //InputInstructions conditionally activate RefreshWalkTarget (by doing what SetWalkTargetVelocity used to do and then flagging it)
Input(InputInstruction), Input(InputInstruction),
//temp
SetSpawnPosition(glam::Vec3),
} }
#[derive(Debug)] #[derive(Debug)]
pub enum InputInstruction { pub enum InputInstruction {
@ -1014,16 +1012,12 @@ impl crate::instruction::InstructionConsumer<PhysicsInstruction> for PhysicsStat
match &ins.instruction { match &ins.instruction {
PhysicsInstruction::Input(InputInstruction::MoveMouse(_)) => (),//dodge time for mouse movement PhysicsInstruction::Input(InputInstruction::MoveMouse(_)) => (),//dodge time for mouse movement
PhysicsInstruction::Input(_) PhysicsInstruction::Input(_)
|PhysicsInstruction::SetSpawnPosition(_)
|PhysicsInstruction::ReachWalkTargetVelocity |PhysicsInstruction::ReachWalkTargetVelocity
|PhysicsInstruction::CollisionStart(_) |PhysicsInstruction::CollisionStart(_)
|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::SetSpawnPosition(position)=>{
self.spawn_point=position;
}
PhysicsInstruction::CollisionStart(c) => { PhysicsInstruction::CollisionStart(c) => {
let model=c.model(&self.models).unwrap(); let model=c.model(&self.models).unwrap();
match &model.attributes{ match &model.attributes{

View File

@ -914,14 +914,11 @@ impl framework::Example for GlobalState {
self.physics.clear(); self.physics.clear();
self.graphics.clear(); self.graphics.clear();
self.physics.game.stage_id=0; self.physics.game.stage_id=0;
self.physics.spawn_point=spawn_point;
self.generate_model_physics(&indexed_model_instances); self.generate_model_physics(&indexed_model_instances);
self.generate_model_graphics(device,queue,indexed_model_instances); self.generate_model_graphics(device,queue,indexed_model_instances);
//manual reset //manual reset
let time=self.physics.time; let time=self.physics.time;
instruction::InstructionConsumer::process_instruction(&mut self.physics, instruction::TimedInstruction{
time,
instruction: body::PhysicsInstruction::SetSpawnPosition(spawn_point),
});
instruction::InstructionConsumer::process_instruction(&mut self.physics, instruction::TimedInstruction{ instruction::InstructionConsumer::process_instruction(&mut self.physics, instruction::TimedInstruction{
time, time,
instruction: body::PhysicsInstruction::Input(body::InputInstruction::Reset), instruction: body::PhysicsInstruction::Input(body::InputInstruction::Reset),