diff --git a/src/Arts.cs b/src/Arts.cs index 3fb82f8..9f15ee3 100644 --- a/src/Arts.cs +++ b/src/Arts.cs @@ -77,11 +77,33 @@ static class Arts box_shake = Vec3.Lerp(box_shake, Vec3.Zero, Time.Stepf / 0.333f); // scale in float box_scale = Mono.box_scale; // Maths.min(Maths.smooth_stop(Maths.u_scalar(Time.Totalf - 3)) * Mono.box_scale, Mono.box_scale); - Hierarchy.Push(Matrix.TRS( - Mono.box_pose.position + (box_shake * U.cm * 0.333f), + Vec3 box_pos = Mono.box_pose.position + (box_shake * U.cm * 0.333f); + Matrix box_m4 = Matrix.TRS( + box_pos, Mono.box_pose.orientation, box_scale - )); + ); + + // hanger + if (Mono.in_cone.state && Mono.box_mode == Mono.BoxMode.Hold || Mono.box_mode == Mono.BoxMode.Mount) + { + float box_head_dist = Vec3.Distance(box_pos, Rig.head.position); + Lines.Add( + box_m4 * V.XYZ(0, Mono.SD_Y - 0.5f, 0), + Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, -box_head_dist), + Color.White, + 1.0f * U.mm + ); + Lines.Add( + Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, -box_head_dist), + Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, 0), + Color.White, + 1.0f * U.mm + ); + } + + // box contents + Hierarchy.Push(box_m4); // meshes["InsideOut"].Draw(mat_unlit, Matrix.Identity); meshes["InsideOut"].Draw( mat_box, @@ -91,15 +113,6 @@ static class Arts Mono.in_dist.state ? mat_justcolor : mat_unlit, Matrix.Identity ); - if (Mono.in_cone.state && Mono.box_mode == Mono.BoxMode.Hold || Mono.box_mode == Mono.BoxMode.Mount) - { - Lines.Add( - V.XYZ(0, Mono.SD_Y - 0.5f, 0), - V.XYZ(0, Mono.SD_Y + 3.0f, 0), - Color.White, - 1.0f * U.mm - ); - } if (Mono.menu) { meshes["Tape"].Draw(mat_mono, Matrix.Identity);