Ejemplo n.º 1
0
 public override void AddVRObject(VRObject obj, int id = -1)
 {
     if (id == -1)
     {
         //obj.transform.SetParent(this.transform, false);
         obj.id = idToAssignNext;
         Debug.Log("id assigned to " + idToAssignNext);
         VRObjectsDict.Add(idToAssignNext, obj);
         idToAssignNext++;
     }
     else
     {
         VRObjectsDict.Add(id, obj);
     }
 }
Ejemplo n.º 2
0
        public override void AddVRObject(VRObject obj, int id = -1)
        {
            base.AddVRObject(obj, id);
            if (id != -1)
            {
                CalculateDistance(id);
            }
            else
            {
                CalculateDistance(idToAssignNext - 1);
            }
            obj.transform.GetChild(0).gameObject.GetComponent <TextMesh>().color = color;

            obj.transform.GetChild(0).gameObject.GetComponent <TextMesh>().text = distanceList[distanceList.Count - 1].distance.ToString();
            ReloadMesh();
        }
        public void ReloadMesh(VRObject obj, int id)
        {
            if (vector1points.Count < 2)
            {
                vector1points.Add(obj.transform.localPosition);
            }
            else if (vector2points.Count < 2)
            {
                vector2points.Add(obj.transform.localPosition);
            }


            List <int>     indices  = new List <int>();
            List <Vector3> vertices = new List <Vector3>();

            if (vector1points.Count == 2)
            {
                vertices.Add(vector1points[0]);
                indices.Add(vertices.Count - 1);
                vertices.Add(vector1points[1]);
                indices.Add(vertices.Count - 1);
            }

            if (vector2points.Count == 2)
            {
                vertices.Add(vector2points[0]);
                indices.Add(vertices.Count - 1);
                vertices.Add(vector2points[1]);
                indices.Add(vertices.Count - 1);
            }

            meshrenderer.material = new Material(Shader.Find("Standard"));

            mesh.vertices = vertices.ToArray();
            mesh.SetIndices(indices.ToArray(), MeshTopology.Lines, 0);
            meshfilter.mesh = mesh;
            if (vector1points.Count == 2 && vector2points.Count == 2)
            {
                CalculateAngle();
                vector1points.Clear();
                vector2points.Clear();
            }
            else if (textobject)
            {
                textobject.GetComponent <TextMesh>().text = "";
            }
        }
Ejemplo n.º 4
0
 public override void AddVRObject(VRObject obj, int id = -1)
 {
     base.AddVRObject(obj, id);
     GenerateHull();
 }
Ejemplo n.º 5
0
 public override void AddVRObject(VRObject obj, int id = -1)
 {
     base.AddVRObject(obj, id);
     obj.transform.GetChild(0).GetComponent <TextMesh>().color = color;
 }
 public override void AddVRObject(VRObject obj, int id)
 {
     base.AddVRObject(obj, id);
     ReloadMesh(obj, id);
 }
Ejemplo n.º 7
0
 public abstract void AddVRObject(VRObject obj, int id);