From c58ea36d289e53516f5ca07276f757441546d14d Mon Sep 17 00:00:00 2001
From: Quaternions <krakow20@gmail.com>
Date: Sun, 11 Feb 2024 03:47:44 -0800
Subject: [PATCH] print speed every 0.6s

---
 src/physics.rs        | 2 +-
 src/physics_worker.rs | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/physics.rs b/src/physics.rs
index cccb4f3..235a5e1 100644
--- a/src/physics.rs
+++ b/src/physics.rs
@@ -727,7 +727,7 @@ enum MoveState{
 
 pub struct PhysicsState{
 	time:Time,
-	body:Body,
+	pub body:Body,
 	world:WorldState,//currently there is only one state the world can be in
 	game:GameMechanicsState,
 	style:StyleModifiers,
diff --git a/src/physics_worker.rs b/src/physics_worker.rs
index 8a483f9..7eebc16 100644
--- a/src/physics_worker.rs
+++ b/src/physics_worker.rs
@@ -27,6 +27,7 @@ pub enum Instruction{
 		let mut mouse_blocking=true;
 		let mut last_mouse_time=physics.next_mouse.time;
 		let mut timeline=std::collections::VecDeque::new();
+		let mut next_velocity_print=std::time::Instant::now();
 		crate::compat_worker::QNWorker::new(move |ins:TimedInstruction<Instruction>|{
 			if if let Some(phys_input)=match &ins.instruction{
 				Instruction::Input(input_instruction)=>match input_instruction{
@@ -110,6 +111,12 @@ pub enum Instruction{
 						instruction:crate::physics::PhysicsInstruction::Input(instruction.instruction),
 					});
 				}
+
+				//some random print stuff
+				if 3.0/5.0<next_velocity_print.elapsed().as_secs_f64(){
+					next_velocity_print=next_velocity_print+std::time::Duration::from_secs_f64(3.0/5.0);
+					println!("speed={}",physics.body.velocity.length());
+				}
 			}
 			match ins.instruction{
 				Instruction::Render=>{