1 using System.Collections.Generic;
4 namespace droid.Runtime.Utilities.GameObjects.BoundingBoxes.Experimental {
10 public Color _Color = Color.green;
12 Dictionary<GameObject, GameObject> _lines =
new Dictionary<GameObject, GameObject>();
14 MeshFilter[] _mesh_filter_objects;
16 void ReallocateLineRenderers() {
17 this._mesh_filter_objects = FindObjectsOfType<MeshFilter>();
24 if (this._lines == null || this._mesh_filter_objects == null) {
25 this.ReallocateLineRenderers();
28 this.CalcPositionsAndDrawBoxes();
31 void CalcPositionsAndDrawBoxes() {
32 foreach (var mesh_filter_object
in this._mesh_filter_objects) {
33 if (mesh_filter_object.gameObject.CompareTag(
"Target")) {
35 if (!this._lines.ContainsKey(mesh_filter_object.gameObject)) {
36 liner = Instantiate(this._Line_Object, this._Line_Object.transform);
37 this._lines.Add(mesh_filter_object.gameObject, liner);
39 Debug.Log(
"found Target");
40 liner = this._lines[mesh_filter_object.gameObject];
43 var bounds = mesh_filter_object.mesh.bounds;
52 var v3_center = bounds.center;
53 var v3_extents = bounds.extents;
55 var corners = Corners.ExtractCorners(v3_center, v3_extents, mesh_filter_object.transform);
57 liner.GetComponent<LineRenderer>().SetPosition(0, corners[4]);
58 liner.GetComponent<LineRenderer>().SetPosition(1, corners[5]);
60 Corners.DrawBox(corners[0],