hack camera offset

This commit is contained in:
2025-01-03 22:11:29 -08:00
committed by Rhys Lloyd
parent 21a90438f9
commit 6251c2d1b2
2 changed files with 7 additions and 2 deletions

View File

@@ -883,7 +883,7 @@ pub struct PhysicsState{
//input_state //input_state
input_state:InputState, input_state:InputState,
//style //style
style:StyleModifiers,//mode style with custom style updates applied pub style:StyleModifiers,//mode style with custom style updates applied
//gameplay_state //gameplay_state
mode_state:ModeState, mode_state:ModeState,
move_state:MoveState, move_state:MoveState,

View File

@@ -37,11 +37,13 @@ struct PlayBacker{
duration:f64, duration:f64,
timer:Timer<Scaled<SessionTimeInner,PhysicsTimeInner>>, timer:Timer<Scaled<SessionTimeInner,PhysicsTimeInner>>,
physics_data:PhysicsData, physics_data:PhysicsData,
camera_offset:strafesnet_common::integer::Planar64Vec3,
} }
impl PlayBacker{ impl PlayBacker{
pub fn new( pub fn new(
physics_data:PhysicsData, physics_data:PhysicsData,
timelines:strafesnet_roblox_bot_file::v0::Block, timelines:strafesnet_roblox_bot_file::v0::Block,
camera_offset:strafesnet_common::integer::Planar64Vec3,
)->Self{ )->Self{
let first=timelines.output_events.first().unwrap(); let first=timelines.output_events.first().unwrap();
let last=timelines.output_events.last().unwrap(); let last=timelines.output_events.last().unwrap();
@@ -52,6 +54,7 @@ impl PlayBacker{
event_id:0, event_id:0,
timer:Timer::from_state(Scaled::identity(),false), timer:Timer::from_state(Scaled::identity(),false),
physics_data, physics_data,
camera_offset,
} }
} }
pub fn handle_instruction(&mut self,TimedInstruction{time,instruction}:&TimedInstruction<SessionInstruction,SessionTime>){ pub fn handle_instruction(&mut self,TimedInstruction{time,instruction}:&TimedInstruction<SessionInstruction,SessionTime>){
@@ -112,7 +115,7 @@ impl PlayBacker{
// let ay_epsilon=f32::from_bits(angles.y.to_bits()&!((1<<23)-1)|1); // let ay_epsilon=f32::from_bits(angles.y.to_bits()&!((1<<23)-1)|1);
let body=Body{ let body=Body{
time, time,
position:strafesnet_common::integer::Planar64Vec3::new(p), position:strafesnet_common::integer::Planar64Vec3::new(p)+self.camera_offset,
velocity:strafesnet_common::integer::Planar64Vec3::new(v), velocity:strafesnet_common::integer::Planar64Vec3::new(v),
acceleration:strafesnet_common::integer::Planar64Vec3::new(a), acceleration:strafesnet_common::integer::Planar64Vec3::new(a),
}; };
@@ -147,6 +150,7 @@ pub fn new<'a>(
user_settings:settings::UserSettings, user_settings:settings::UserSettings,
)->crate::compat_worker::QNWorker<'a,TimedInstruction<Instruction,SessionTime>>{ )->crate::compat_worker::QNWorker<'a,TimedInstruction<Instruction,SessionTime>>{
let physics=strafesnet_physics::physics::PhysicsState::default(); let physics=strafesnet_physics::physics::PhysicsState::default();
let camera_offset=physics.style.camera_offset;
let timer=Timer::unpaused(SessionTime::ZERO,PhysicsTime::ZERO); let timer=Timer::unpaused(SessionTime::ZERO,PhysicsTime::ZERO);
let simulation=Simulation::new(timer,physics); let simulation=Simulation::new(timer,physics);
let mut session=Session::new( let mut session=Session::new(
@@ -161,6 +165,7 @@ pub fn new<'a>(
let mut interpolator=PlayBacker::new( let mut interpolator=PlayBacker::new(
physics, physics,
bot_file, bot_file,
camera_offset,
); );
crate::compat_worker::QNWorker::new(move |ins:TimedInstruction<Instruction,SessionTime>|{ crate::compat_worker::QNWorker::new(move |ins:TimedInstruction<Instruction,SessionTime>|{
// excruciating pain // excruciating pain