diff --git a/Assets/InteractionEngine/FactSpawner.cs b/Assets/InteractionEngine/FactSpawner.cs index 58b91125495b38328c455dd47d59c9a2bcb65991..dc1c04251758ac277996bb06bef7a0b7283ce7e4 100644 --- a/Assets/InteractionEngine/FactSpawner.cs +++ b/Assets/InteractionEngine/FactSpawner.cs @@ -63,9 +63,10 @@ public void SpawnPoint(PointFact fact) public void SpawnLine(LineFact lineFact) { - - Vector3 point1 = (Facts[lineFact.Pid1] as PointFact).Point; - Vector3 point2 = (Facts[lineFact.Pid2] as PointFact).Point; + PointFact pointFact1 = (Facts[lineFact.Pid1] as PointFact); + PointFact pointFact2 = (Facts[lineFact.Pid2] as PointFact); + Vector3 point1 = pointFact1.Point; + Vector3 point2 = pointFact2.Point; //Change FactRepresentation to Line this.FactRepresentation = (GameObject)Resources.Load("Prefabs/Line", typeof(GameObject)); GameObject line = GameObject.Instantiate(FactRepresentation); @@ -85,8 +86,10 @@ public void SpawnLine(LineFact lineFact) line.transform.GetChild(0).localScale = v3T; line.transform.GetChild(0).rotation = Quaternion.FromToRotation(Vector3.right, point2 - point1); - string letter = ((Char)(64 + lineFact.Id + 1)).ToString(); - line.GetComponentInChildren<TextMeshPro>().text = letter; + //string letter = ((Char)(64 + lineFact.Id + 1)).ToString(); + //line.GetComponentInChildren<TextMeshPro>().text = letter; + line.GetComponentInChildren<TextMeshPro>().text = ((Char)(64 + pointFact1.Id + 1)).ToString() + ((Char)(64 + pointFact2.Id + 1)).ToString(); + line.GetComponentInChildren<TextMeshPro>().text += " = " + Math.Round((point1-point2).magnitude, 2).ToString() + " m"; line.GetComponentInChildren<FactObject>().Id = lineFact.Id; //If a new Line was spawned -> We are in CreateLineMode -> Then we want the collider to be disabled if (CommunicationEvents.ActiveToolMode != ToolMode.ExtraMode) diff --git a/Assets/Resources/Prefabs/Line.prefab b/Assets/Resources/Prefabs/Line.prefab index ac7c2bca63435944471b43c1d35fbafe1eb6b516..b33f04790fdb12d99ba6260b0542addf0fed07f1 100644 --- a/Assets/Resources/Prefabs/Line.prefab +++ b/Assets/Resources/Prefabs/Line.prefab @@ -70,7 +70,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 0.7} - m_SizeDelta: {x: 2, y: 0.5} + m_SizeDelta: {x: 4, y: 0.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!23 &2096909858734684758 MeshRenderer: