{
  "format_version": "1.10.0",
  "animation_controllers": {

    "controller.animation.mythicus_im.hdc.block.outline.root": {
      "states": {

        "default": {
          "on_entry": [
            "v.bo_ac_init = 1;",
            
            "v.bo_pos_xc = q.position(0);",
            "v.bo_pos_x0 = v.bo_pos_xc - v.bo_size_x * 0.5 * 0.0625;",
            "v.bo_pos_x1 = v.bo_pos_xc + v.bo_size_x * 0.5 * 0.0625;",
            "v.bo_pos_yc = q.position(1);",
            "v.bo_pos_y0 = v.bo_pos_yc - v.bo_size_y * 0.5 * 0.0625;",
            "v.bo_pos_y1 = v.bo_pos_yc + v.bo_size_y * 0.5 * 0.0625;",
            "v.bo_pos_zc = q.position(2);",
            "v.bo_pos_z0 = v.bo_pos_zc - v.bo_size_z * 0.5 * 0.0625;",
            "v.bo_pos_z1 = v.bo_pos_zc + v.bo_size_z * 0.5 * 0.0625;"
          ],
          "transitions": [ { "idle": "v.bo_ac_init ?? 0" } ]
        },

        "idle": {
          "on_entry": [ "v.bo_visible = 0;" ],
          "transitions": [ { "parse": "q.distance_from_camera <= 4.0" } ]
        },
        "tick": {
          "transitions": [ 
            { "idle": "q.distance_from_camera > 4.0" },
            { "parse": "1" }
          ]
        },
        "parse": {
          "on_entry": [
            "v.player_dv_x = Math.cos(q.camera_rotation(0)) * Math.sin(q.camera_rotation(1));",
            "v.player_dv_y = Math.sin(q.camera_rotation(0));",
            "v.player_dv_z = Math.cos(q.camera_rotation(0)) * Math.cos(q.camera_rotation(1));",

            "v.player_pos_x = v.bo_pos_xc - q.distance_from_camera * Math.cos(q.rotation_to_camera(0)) * Math.sin(q.rotation_to_camera(1));",
            "v.player_pos_y = v.bo_pos_y0 - q.distance_from_camera * Math.sin(q.rotation_to_camera(0));",
            "v.player_pos_z = v.bo_pos_zc - q.distance_from_camera * Math.cos(q.rotation_to_camera(0)) * Math.cos(q.rotation_to_camera(1));",

            "v.bo_tx0 = ((v.player_dv_x >= 0 ? v.bo_pos_x0 : v.bo_pos_x1) - v.player_pos_x) / v.player_dv_x;",
            "v.bo_tx1 = ((v.player_dv_x >= 0 ? v.bo_pos_x1 : v.bo_pos_x0) - v.player_pos_x) / v.player_dv_x;",
            "v.bo_ty0 = ((v.player_dv_y >= 0 ? v.bo_pos_y0 : v.bo_pos_y1) - v.player_pos_y) / v.player_dv_y;",
            "v.bo_ty1 = ((v.player_dv_y >= 0 ? v.bo_pos_y1 : v.bo_pos_y0) - v.player_pos_y) / v.player_dv_y;",
            "v.bo_tz0 = ((v.player_dv_z >= 0 ? v.bo_pos_z0 : v.bo_pos_z1) - v.player_pos_z) / v.player_dv_z;",
            "v.bo_tz1 = ((v.player_dv_z >= 0 ? v.bo_pos_z1 : v.bo_pos_z0) - v.player_pos_z) / v.player_dv_z;",

            "v.bo_t0 = Math.max(v.bo_tx0, Math.max(v.bo_ty0, v.bo_tz0));",
            "v.bo_t1 = Math.min(v.bo_tx1, Math.min(v.bo_ty1, v.bo_tz1));",

            "v.bo_visible = v.bo_t0 <= v.bo_t1;"
          ],
          "transitions": [ { "tick": "1" } ]
        }

      }
    }

  }
}