From 7312d13d2d6941e0f49db5443b7b7512a0ee5abe Mon Sep 17 00:00:00 2001 From: ghostlyzsh Date: Sun, 7 Jan 2024 20:43:02 -0600 Subject: [PATCH] some of load fix, commiting for pull --- server/src/main.rs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/server/src/main.rs b/server/src/main.rs index 7750568663b23eb7cda59c1cbdb10d53bfd34381..d8f3ef55b875f1129ddbb29761bb6e0defc55c95 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -968,16 +968,20 @@ fn load_savefile( let mut offset = Vec2::ZERO; let mut angle_offset = 0.; if i == 2 { - offset = Vec2::new(53., -53.); + //offset = Vec2::new(53., -53.); + offset = Vec2::new(0., -53.); angle_offset = 0.; } else if i == 0 { - offset = Vec2::new(-53., 53.); + //offset = Vec2::new(-53., 53.); + offset = Vec2::new(0., 53.); angle_offset = PI; } else if i == 1 { - offset = Vec2::new(53., 53.); + //offset = Vec2::new(53., 53.); + offset = Vec2::new(53., 0.); angle_offset = PI / 2.; } else if i == 3 { - offset = Vec2::new(-53., -53.); + //offset = Vec2::new(-53., 53.); + offset = Vec2::new(-53., 0.); angle_offset = -PI / 2.; } @@ -985,8 +989,8 @@ fn load_savefile( let module = commands.spawn(PartBundle { transform: TransformBundle::from( Transform::from_xyz( - p_pos.x + offset.x / SCALE * angle.cos(), - p_pos.y + offset.y / SCALE * angle.sin(), + (p_pos.x + offset.x * angle.cos()) / SCALE, + (p_pos.y + offset.y * angle.sin()) / SCALE, 0., ) .with_rotation(Quat::from_euler( @@ -1048,8 +1052,8 @@ fn load_savefile( .insert(ReadMassProperties::default()); let joint = FixedJointBuilder::new() - .local_anchor1(vec2(-53. / SCALE, 0. / SCALE)) - .local_basis2(-PI / 2.); + .local_anchor1(vec2(offset.x / SCALE, offset.y / SCALE)) + .local_basis2(angle_offset); module.insert(ImpulseJoint::new(parent, joint)); @@ -1065,8 +1069,8 @@ fn load_savefile( .insert(PartBundle { transform: TransformBundle::from( Transform::from_xyz( - p_pos.x + offset.x / SCALE * angle.cos(), - p_pos.y + offset.y / SCALE * angle.sin(), + (p_pos.x + offset.x * angle.cos()) / SCALE, + (p_pos.y + offset.y * angle.sin()) / SCALE, 0., ) .with_rotation(Quat::from_euler(