From d12feb9bf3d961e1a62bef40dd2e44cbdbe26a9b Mon Sep 17 00:00:00 2001
From: Richard Marcus <richard.marcus@fau.de>
Date: Fri, 10 Jan 2020 16:38:02 +0100
Subject: [PATCH] 90degree angle now requires two steps

---
 Assets/FactManager.cs                   | 37 +++++++++++++++++++++----
 Assets/InteractionEngine/WorldCursor.cs |  3 +-
 2 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/Assets/FactManager.cs b/Assets/FactManager.cs
index 43dbbc74..f0354211 100644
--- a/Assets/FactManager.cs
+++ b/Assets/FactManager.cs
@@ -22,7 +22,7 @@ void Start()
     {
         CommunicationEvents.ToolModeChangedEvent.AddListener(OnToolModeChanged);
         CommunicationEvents.TriggerEvent.AddListener(OnHit);
-        CommunicationEvents.SnapEvent.AddListener(Rocket);
+      //  CommunicationEvents.SnapEvent.AddListener(Rocket);
 
         //We dont want to have this here anymore...
         //CommunicationEvents.RemoveFactEvent.AddListener(DeleteFact);
@@ -176,6 +176,10 @@ public void OnToolModeChanged(ToolMode ActiveToolMode)
         }
     }
 
+
+
+
+
     //automatic 90 degree angle construction
     public void Rocket(RaycastHit hit)
     {
@@ -207,11 +211,31 @@ public void Rocket(RaycastHit hit)
 
         //90degree angle
         CommunicationEvents.AddFactEvent.Invoke(this.AddAngleFact(idB,idA,idC, GetFirstEmptyID()));
+    }
+
+    public void SmallRocket(RaycastHit hit,  int idA)
+    {
+        int idB = this.GetFirstEmptyID();
+        CommunicationEvents.AddFactEvent.Invoke(this.AddPointFact(hit, idB));
 
 
+        //third point with unknown height
+        int idC = this.GetFirstEmptyID();
+        var skyHit = hit;
+        skyHit.point = (Facts[idA] as PointFact).Point+ Vector3.up * 20;
+        CommunicationEvents.AddFactEvent.Invoke(this.AddPointFact(skyHit, idC));
 
+        //lines
+        CommunicationEvents.AddFactEvent.Invoke(this.AddLineFact(idA, idB, this.GetFirstEmptyID()));
+        //lines
+        CommunicationEvents.AddFactEvent.Invoke(this.AddLineFact(idA, idC, this.GetFirstEmptyID()));
 
+        //90degree angle
+        CommunicationEvents.AddFactEvent.Invoke(this.AddAngleFact(idB, idA, idC, GetFirstEmptyID()));
     }
+
+
+
     public void OnHit(RaycastHit hit)
     {
         
@@ -251,13 +275,14 @@ public void OnHit(RaycastHit hit)
                 {
                     if (this.lineModeIsFirstPointSelected)
                     {
-                        //Event for end of line-drawing in "ShinyThings"
-                        int id = this.GetFirstEmptyID();
-                        CommunicationEvents.AddFactEvent.Invoke(this.AddPointFact(hit,id ));
+    
 
                         CommunicationEvents.StopLineDrawingEvent.Invoke(null);
-                        //Create LineFact
-                        CommunicationEvents.AddFactEvent.Invoke(this.AddLineFact(this.lineModeFirstPointSelected.Id,id, this.GetFirstEmptyID()));
+
+
+                        SmallRocket(hit,this.lineModeFirstPointSelected.Id);
+
+
                         this.lineModeIsFirstPointSelected = false;
                         this.lineModeFirstPointSelected = null;
                     }
diff --git a/Assets/InteractionEngine/WorldCursor.cs b/Assets/InteractionEngine/WorldCursor.cs
index cd3e8be7..e777c510 100644
--- a/Assets/InteractionEngine/WorldCursor.cs
+++ b/Assets/InteractionEngine/WorldCursor.cs
@@ -79,7 +79,8 @@ void CheckMouseButtons(bool OnSnap=false)
             }
             else {
                 Hit.collider.enabled = false;
-                CommunicationEvents.SnapEvent.Invoke(Hit);
+                CommunicationEvents.TriggerEvent.Invoke(Hit);
+            //    CommunicationEvents.SnapEvent.Invoke(Hit);
             }
                 
 
-- 
GitLab