From 1d8e8904f83c603ee05022ab934af06401066f16 Mon Sep 17 00:00:00 2001 From: ghostlyzsh Date: Thu, 18 May 2023 15:58:45 -0500 Subject: [PATCH] rotation bug vanquished, but preattached modules still exist (please remove) --- server/src/handler.rs | 12 ++++++------ server/src/module.rs | 13 ++++--------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/server/src/handler.rs b/server/src/handler.rs index dcb953c3d8a7905013d4e83d9d99f96302967c11..6bab6f1cb2ec33a5530cd6d22bf25eb3d6f1be76 100644 --- a/server/src/handler.rs +++ b/server/src/handler.rs @@ -275,7 +275,7 @@ pub async fn handle_client( data_handle.rigid_body_set = rigid_body_set; data_handle.collider_set = collider_set; - /*let module_id = AttachedModule::attach_new( + let module_id = AttachedModule::attach_new( &mut data_handle, &mut e_write_handle, player_id, @@ -290,8 +290,8 @@ pub async fn handle_client( module_type: ModuleType::Cargo, }, 1, - );*/ - /*let module_id = AttachedModule::attach_new( + ); + let module_id = AttachedModule::attach_new( &mut data_handle, &mut e_write_handle, module_id, @@ -305,7 +305,7 @@ pub async fn handle_client( ), module_type: ModuleType::Cargo, }, - 1, + 2, ); let module_id = AttachedModule::attach_new( &mut data_handle, @@ -321,8 +321,8 @@ pub async fn handle_client( ), module_type: ModuleType::Hub, }, - 1, - );*/ + 2, + ); } } MessageC2S::Goodbye(pkt) => { diff --git a/server/src/module.rs b/server/src/module.rs index df6bbd927c32d1d8a3be53dfeabbd1cee9e637d6..e4669d854b395dc8f75d4203abb4a5aff491fa51 100644 --- a/server/src/module.rs +++ b/server/src/module.rs @@ -175,16 +175,11 @@ impl AttachedModule { }; let relative_pos = - vector![anchor.x * (rotation + parent_body.rotation().angle()).cos() + - anchor.y * -(rotation + parent_body.rotation().angle()).sin(), - anchor.x * (rotation + parent_body.rotation().angle()).sin() + - anchor.y * (rotation + parent_body.rotation().angle()).cos()]; + vector![anchor.x * (parent_body.rotation().angle()).cos() + + anchor.y * -(parent_body.rotation().angle()).sin(), + anchor.x * (parent_body.rotation().angle()).sin() + + anchor.y * (parent_body.rotation().angle()).cos()]; let module_pos = parent_pos + relative_pos; - debug!("real pos: {}", parent_pos + relative_pos); - debug!("parent pos: {}", parent_pos); - debug!("relative pos: {}", relative_pos); - debug!("real heading: {}", rotation.to_degrees() + parent_body.rotation().angle().to_degrees()); - debug!("parent heading: {}", parent_body.rotation().angle().to_degrees()); // create attachment module let module_collider = ColliderBuilder::cuboid(25.0 / SCALE, 25.0 / SCALE)