forked from StrafesNET/strafe-client
Compare commits
No commits in common. "Only-Velocity" and "master" have entirely different histories.
Only-Veloc
...
master
@ -45,7 +45,6 @@ pub struct Body{
|
|||||||
pub acceleration:Planar64Vec3,//I64 where 2^32 = 1 u/s/s
|
pub acceleration:Planar64Vec3,//I64 where 2^32 = 1 u/s/s
|
||||||
pub time:Time,//nanoseconds x xxxxD!
|
pub time:Time,//nanoseconds x xxxxD!
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::ops::Neg for Body{
|
impl std::ops::Neg for Body{
|
||||||
type Output=Self;
|
type Output=Self;
|
||||||
fn neg(self)->Self::Output{
|
fn neg(self)->Self::Output{
|
||||||
@ -1178,7 +1177,7 @@ impl PhysicsState {
|
|||||||
ordered_checkpoint_from_checkpoint_id:eshmep2,
|
ordered_checkpoint_from_checkpoint_id:eshmep2,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// println!("Physics Objects: {}",self.models.models.len());
|
println!("Physics Objects: {}",self.models.models.len());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn load_user_settings(&mut self,user_settings:&crate::settings::UserSettings){
|
pub fn load_user_settings(&mut self,user_settings:&crate::settings::UserSettings){
|
||||||
@ -1361,7 +1360,7 @@ fn set_velocity_cull(body:&mut Body,touching:&mut TouchingState,models:&PhysicsM
|
|||||||
let r=n.dot(v)<=Planar64::ZERO;
|
let r=n.dot(v)<=Planar64::ZERO;
|
||||||
if !r{
|
if !r{
|
||||||
culled=true;
|
culled=true;
|
||||||
// println!("set_velocity_cull contact={:?}",contact);
|
println!("set_velocity_cull contact={:?}",contact);
|
||||||
}
|
}
|
||||||
r
|
r
|
||||||
});
|
});
|
||||||
@ -1381,7 +1380,7 @@ fn set_acceleration_cull(body:&mut Body,touching:&mut TouchingState,models:&Phys
|
|||||||
let r=n.dot(a)<=Planar64::ZERO;
|
let r=n.dot(a)<=Planar64::ZERO;
|
||||||
if !r{
|
if !r{
|
||||||
culled=true;
|
culled=true;
|
||||||
// println!("set_acceleration_cull contact={:?}",contact);
|
println!("set_acceleration_cull contact={:?}",contact);
|
||||||
}
|
}
|
||||||
r
|
r
|
||||||
});
|
});
|
||||||
@ -1477,7 +1476,7 @@ impl instruction::InstructionConsumer<PhysicsInstruction> for PhysicsState {
|
|||||||
|PhysicsInstruction::Input(PhysicsInputInstruction::SetNextMouse(_))
|
|PhysicsInstruction::Input(PhysicsInputInstruction::SetNextMouse(_))
|
||||||
|PhysicsInstruction::Input(PhysicsInputInstruction::ReplaceMouse(_,_))
|
|PhysicsInstruction::Input(PhysicsInputInstruction::ReplaceMouse(_,_))
|
||||||
|PhysicsInstruction::StrafeTick=>(),
|
|PhysicsInstruction::StrafeTick=>(),
|
||||||
_=> print!(""), //println!("{}|{:?}",ins.time,ins.instruction),
|
_=>println!("{}|{:?}",ins.time,ins.instruction),
|
||||||
}
|
}
|
||||||
//selectively update body
|
//selectively update body
|
||||||
match &ins.instruction{
|
match &ins.instruction{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use crate::physics::{MouseState,PhysicsInputInstruction, PhysicsState};
|
use crate::physics::{MouseState,PhysicsInputInstruction};
|
||||||
use strafesnet_common::integer::Time;
|
use strafesnet_common::integer::Time;
|
||||||
use strafesnet_common::instruction::{TimedInstruction,InstructionConsumer};
|
use strafesnet_common::instruction::{TimedInstruction,InstructionConsumer};
|
||||||
use strafesnet_common::integer::{self,Planar64,Planar64Vec3,Planar64Mat3,Angle32,Ratio64,Ratio64Vec2};
|
use strafesnet_common::integer::{self,Planar64,Planar64Vec3,Planar64Mat3,Angle32,Ratio64,Ratio64Vec2};
|
||||||
@ -24,28 +24,36 @@ pub enum Instruction{
|
|||||||
ClearModels,
|
ClearModels,
|
||||||
//Graphics(crate::graphics_worker::Instruction),
|
//Graphics(crate::graphics_worker::Instruction),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Speed{
|
pub struct Speed{
|
||||||
pub player_vel:Planar64Vec3,
|
pub player_vel:Planar64Vec3,
|
||||||
pub time:Time,
|
pub time:Time
|
||||||
pub start_time:Option<Time>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Speed{
|
impl std::ops::Neg for Speed{
|
||||||
pub fn new(self,player_vel:Planar64Vec3,time:Time)->Self{
|
type Output=Self;
|
||||||
|
fn neg(self)->Self::Output{
|
||||||
Self{
|
Self{
|
||||||
player_vel,
|
player_vel:self.player_vel,
|
||||||
time,
|
time:self.time
|
||||||
start_time:None,
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Speed{
|
||||||
|
pub fn new(player_vel:Planar64Vec3,time:Time)->Self{
|
||||||
|
Self{
|
||||||
|
player_vel,
|
||||||
|
time,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
pub fn new(mut physics:crate::physics::PhysicsState,mut graphics_worker:crate::compat_worker::INWorker<crate::graphics_worker::Instruction>)->crate::compat_worker::QNWorker<TimedInstruction<Instruction>>{
|
pub fn new(mut physics:crate::physics::PhysicsState,mut graphics_worker:crate::compat_worker::INWorker<crate::graphics_worker::Instruction>)->crate::compat_worker::QNWorker<TimedInstruction<Instruction>>{
|
||||||
let mut mouse_blocking=true;
|
let mut mouse_blocking=true;
|
||||||
let mut last_mouse_time=physics.next_mouse.time;
|
let mut last_mouse_time=physics.next_mouse.time;
|
||||||
let mut timeline=std::collections::VecDeque::new();
|
let mut timeline=std::collections::VecDeque::new();
|
||||||
let mut next_velocity_print=std::time::Instant::now();
|
let mut next_velocity_print=std::time::Instant::now();
|
||||||
|
let mut player_vel = physics.body.velocity.length();
|
||||||
crate::compat_worker::QNWorker::new(move |ins:TimedInstruction<Instruction>|{
|
crate::compat_worker::QNWorker::new(move |ins:TimedInstruction<Instruction>|{
|
||||||
if if let Some(phys_input)=match &ins.instruction{
|
if if let Some(phys_input)=match &ins.instruction{
|
||||||
Instruction::Input(input_instruction)=>match input_instruction{
|
Instruction::Input(input_instruction)=>match input_instruction{
|
||||||
@ -130,11 +138,10 @@ impl Speed{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
//some random print stuff
|
//some random print stuff
|
||||||
if 3.0/5.0<next_velocity_print.elapsed().as_secs_f64(){
|
if 3.0/5.0<next_velocity_print.elapsed().as_secs_f64(){
|
||||||
next_velocity_print=next_velocity_print+std::time::Duration::from_secs_f64(1.0/10.0);
|
next_velocity_print=next_velocity_print+std::time::Duration::from_secs_f64(1.0/30.0);
|
||||||
println!("xz Velocity: {} u/s", (Planar64Vec3::new(physics.body.velocity.x(), Planar64::int(0), physics.body.velocity.z())).length());
|
println!("velocity: {} u/s", (Planar64Vec3::new(physics.body.velocity.x(), Planar64::int(0), physics.body.velocity.z())).length()*(Planar64::int(130)/9));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
match ins.instruction{
|
match ins.instruction{
|
||||||
Instruction::Render=>{
|
Instruction::Render=>{
|
||||||
|
Loading…
Reference in New Issue
Block a user