diff --git a/Assets/Resources/Prefabs/Facts/Circle.prefab b/Assets/Resources/Prefabs/Facts/Circle.prefab index f3223214b818003441e53677c88042e88cd413f4..aece8bb6c2a5f424fafa2d6a9959d4ab6b9d99ab 100644 --- a/Assets/Resources/Prefabs/Facts/Circle.prefab +++ b/Assets/Resources/Prefabs/Facts/Circle.prefab @@ -110,7 +110,6 @@ GameObject: - component: {fileID: 142224692930156368} - component: {fileID: 7167210412035754299} - component: {fileID: 1078883255209641429} - - component: {fileID: 7621282258514180204} - component: {fileID: 5602986836502461330} - component: {fileID: 8419554499757686208} - component: {fileID: 8526453253978894086} @@ -187,21 +186,6 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} ---- !u!114 &7621282258514180204 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6262947649539239553} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 405087c38b8537e43bcc99727c5325ec, type: 3} - m_Name: - m_EditorClassIdentifier: - radius: 1 - sideCount: 500 - circleMesh: {fileID: 7167210412035754299} --- !u!114 &5602986836502461330 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Resources/Prefabs/Facts/Line.prefab b/Assets/Resources/Prefabs/Facts/Line.prefab index 76c0c28bc6a7552bd99de452c201fc4f8d78b6fd..97d90b5c2d3568872f7e15725b472a7c2f48b730 100644 --- a/Assets/Resources/Prefabs/Facts/Line.prefab +++ b/Assets/Resources/Prefabs/Facts/Line.prefab @@ -59,14 +59,14 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4853696702160906218} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalRotation: {x: -0, y: 0.7071068, z: -0, w: 0.7071068} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 5818562496562931847} m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 0.7} @@ -221,6 +221,39 @@ MonoBehaviour: Cam1: {fileID: 0} Cam2: {fileID: 0} BackUPCam: {fileID: 0} +--- !u!1 &6028669276398914237 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2267903722640728620} + m_Layer: 11 + m_Name: RealLine + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2267903722640728620 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6028669276398914237} + m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 3517099398133763913} + - {fileID: 2374130608748553515} + m_Father: {fileID: 3655214872469710227} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0} --- !u!1 &6247621022589904505 GameObject: m_ObjectHideFlags: 0 @@ -248,11 +281,11 @@ Transform: m_GameObject: {fileID: 6247621022589904505} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 0.96, y: 0.102, z: 0.102} - m_ConstrainProportionsScale: 0 + m_LocalScale: {x: 1.01, y: 1.01, z: 1.01} + m_ConstrainProportionsScale: 1 m_Children: [] - m_Father: {fileID: 3655214872469710227} - m_RootOrder: 2 + m_Father: {fileID: 2374130608748553515} + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!33 &2701943617241909663 MeshFilter: @@ -334,11 +367,11 @@ Transform: m_GameObject: {fileID: 6378548342073962023} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 0.2, z: 0.2} + m_LocalScale: {x: 1.05, y: 0.2, z: 0.2} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 3655214872469710227} - m_RootOrder: 1 + m_Father: {fileID: 2267903722640728620} + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!33 &6398251481098695290 MeshFilter: @@ -458,7 +491,7 @@ GameObject: m_Component: - component: {fileID: 3655214872469710227} m_Layer: 11 - m_Name: RealLine + m_Name: PrefabHandle0 m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -476,9 +509,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 2374130608748553515} - - {fileID: 3517099398133763913} - - {fileID: 4678806186037624479} + - {fileID: 2267903722640728620} m_Father: {fileID: 5818562496562931847} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -509,11 +540,12 @@ Transform: m_GameObject: {fileID: 8536634090652517107} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 0.95, y: 0.1, z: 0.1} + m_LocalScale: {x: 1, y: 0.1, z: 0.1} m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 3655214872469710227} - m_RootOrder: 0 + m_Children: + - {fileID: 4678806186037624479} + m_Father: {fileID: 2267903722640728620} + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!33 &8620665629189134186 MeshFilter: diff --git a/Assets/Resources/Prefabs/Facts/Ray.prefab b/Assets/Resources/Prefabs/Facts/Ray.prefab index 09f96326bd251866bdbe1011a323be0604a645d1..7362fd75119ea21e039628917517f80a38e7e4f1 100644 --- a/Assets/Resources/Prefabs/Facts/Ray.prefab +++ b/Assets/Resources/Prefabs/Facts/Ray.prefab @@ -28,11 +28,44 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 3517099398133763913} + - {fileID: 8788144280623546556} - {fileID: 7972877566157790116} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &2715767601543569183 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8788144280623546556} + m_Layer: 13 + m_Name: PrefabHandle0 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8788144280623546556 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2715767601543569183} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 3517099398133763913} + - {fileID: 2374130608748553515} + m_Father: {fileID: 5818562496562931847} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &3751826764213783083 GameObject: m_ObjectHideFlags: 0 @@ -58,13 +91,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 3751826764213783083} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 0.96, y: 0.56, z: 0.56} + m_LocalScale: {x: 1.01, y: 1.1, z: 1.1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 3517099398133763913} - m_RootOrder: 1 + m_Father: {fileID: 2374130608748553515} + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!33 &669189071706237370 MeshFilter: @@ -142,14 +175,14 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 4853696702160906218} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 5818562496562931847} m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 0.7} @@ -332,16 +365,14 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6378548342073962023} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalRotation: {x: -0, y: 0.7071068, z: -0, w: 0.7071068} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 0.15, z: 0.15} + m_LocalScale: {x: 1.05, y: 0.15, z: 0.15} m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 2374130608748553515} - - {fileID: 2155667380501583430} - m_Father: {fileID: 5818562496562931847} + m_Children: [] + m_Father: {fileID: 8788144280623546556} m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0} --- !u!33 &6398251481098695290 MeshFilter: m_ObjectHideFlags: 0 @@ -475,13 +506,14 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8536634090652517107} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalRotation: {x: -0, y: 0.7071068, z: -0, w: 0.7071068} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 0.95, y: 0.5, z: 0.5} + m_LocalScale: {x: 1, y: 0.075, z: 0.075} m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 3517099398133763913} - m_RootOrder: 0 + m_Children: + - {fileID: 2155667380501583430} + m_Father: {fileID: 8788144280623546556} + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!33 &8620665629189134186 MeshFilter: diff --git a/Assets/Resources/Prefabs/UI/FrameITUI.prefab b/Assets/Resources/Prefabs/UI/FrameITUI.prefab index f3218c9618bf35306764487e3f295ad51e2bb4d6..4d7c869efa025d9726d41aae318d3351624070a0 100644 --- a/Assets/Resources/Prefabs/UI/FrameITUI.prefab +++ b/Assets/Resources/Prefabs/UI/FrameITUI.prefab @@ -473,6 +473,71 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 1063267682327585421} m_Modifications: + - target: {fileID: 173290219472098764, guid: 292834880e6f0e54186b873acc62d3f2, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 173290219472098764, guid: 292834880e6f0e54186b873acc62d3f2, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 173290219472098764, guid: 292834880e6f0e54186b873acc62d3f2, + type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 173290219472098764, guid: 292834880e6f0e54186b873acc62d3f2, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 173290219472098764, guid: 292834880e6f0e54186b873acc62d3f2, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 173290219472098764, guid: 292834880e6f0e54186b873acc62d3f2, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3716020922907832516, guid: 292834880e6f0e54186b873acc62d3f2, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3853195430673864773, guid: 292834880e6f0e54186b873acc62d3f2, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3853195430673864773, guid: 292834880e6f0e54186b873acc62d3f2, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3853195430673864773, guid: 292834880e6f0e54186b873acc62d3f2, + type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3853195430673864773, guid: 292834880e6f0e54186b873acc62d3f2, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3853195430673864773, guid: 292834880e6f0e54186b873acc62d3f2, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3853195430673864773, guid: 292834880e6f0e54186b873acc62d3f2, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 4335843193789688460, guid: 292834880e6f0e54186b873acc62d3f2, type: 3} propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Target @@ -483,6 +548,16 @@ PrefabInstance: propertyPath: onValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName value: FavoritesFilterChanged objectReference: {fileID: 0} + - target: {fileID: 6500467619489830996, guid: 292834880e6f0e54186b873acc62d3f2, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6500467619489830996, guid: 292834880e6f0e54186b873acc62d3f2, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 7849991042685492731, guid: 292834880e6f0e54186b873acc62d3f2, type: 3} propertyPath: m_AnchorMax.y diff --git a/Assets/Scripts/InteractionEngine/FactHandling/AbstractLineFact.cs b/Assets/Scripts/InteractionEngine/FactHandling/AbstractLineFact.cs index 59acbab4fa4a1ca6fdf68e06ed45cce490bea85b..2c851c997e7ce90fa8bd61afe5d1188c47a649d2 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/AbstractLineFact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/AbstractLineFact.cs @@ -83,12 +83,18 @@ private void set_public_members(string pid1, string pid2) { this.Pid1 = pid1; this.Pid2 = pid2; - this.Dir = (Point1.Point - Point2.Point).normalized; - this.Distance = Dir.magnitude; + Vector3 diff = (Point1.Point - Point2.Point); + this.Dir = diff.normalized; + this.Distance = diff.magnitude; + RecalulateTransform(); + } + + protected override void RecalulateTransform() + { Position = Vector3.Lerp(Point1.Point, Point2.Point, 0.5f); Rotation = Quaternion.LookRotation(Dir, Vector3.up); - LocalScale.Set(Distance, 1, 1); + LocalScale = new Vector3(1, 1, Distance); } /// \copydoc Fact.hasDependentFacts @@ -247,7 +253,11 @@ public RayFact(RayFact fact, Dictionary<string, string> old_to_new, FactOrganize /// <summary> \copydoc AbstractLineFact.AbstractLineFact(string, string, string, FactOrganizer) </summary> public RayFact(string pid1, string pid2, string backendURI, FactOrganizer organizer) : base(pid1, pid2, backendURI, organizer) - => _ = this.Label; + { + _ = this.Label; + + RecalulateTransform(); + } /// <summary> \copydoc AbstractLineFact.AbstractLineFact(string, string, FactOrganizer) </summary> public RayFact(string pid1, string pid2, FactOrganizer organizer) : base(pid1, pid2, organizer) @@ -260,7 +270,7 @@ public RayFact(string pid1, string pid2, FactOrganizer organizer) : base(pid1, p /// <param name="pid2">sets <see cref="AbstractLineFact.Pid2"/></param> private void init(string pid1, string pid2) { - LocalScale = new Vector3(float.PositiveInfinity, 1, 1); + RecalulateTransform(); SOMDoc tp = new OMS(MMT_OMS_URI.LineType); SOMDoc df = new OMA( @@ -275,6 +285,12 @@ private void init(string pid1, string pid2) ParsingDictionary.parseTermsToId[df.ToString()] = this._URI; } + protected override void RecalulateTransform() + { + base.RecalulateTransform(); + LocalScale = new Vector3(1, 1, 2048); + } + /// \copydoc Fact.parseFact(Scroll.ScrollFact) public new static RayFact parseFact(Scroll.ScrollFact fact) { diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Fact.cs b/Assets/Scripts/InteractionEngine/FactHandling/Fact.cs index 9534e20b5d9d9b01888e1203430a9f61bf6a9b41..d8743397c101e0385c893ee6044f0b56c3540bad 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Fact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Fact.cs @@ -297,6 +297,8 @@ public bool rename(string newLabel) // TODO: set Representation here instead of ... public abstract GameObject instantiateDisplay(GameObject prefab, Transform transform); + protected abstract void RecalulateTransform(); + /// <summary> /// Frees ressources e.g. <see cref="Label"/> and will eventually delete %Fact Server-Side in far-near future when feature is supported. /// </summary> @@ -458,8 +460,7 @@ private void init(Vector3 P, Vector3 N) this.Point = P; this.Normal = N; - Position = P; - Rotation = Quaternion.LookRotation(N); + RecalulateTransform(); SOMDoc tp = new OMS(MMT_OMS_URI.Point); SOMDoc df = new OMA( @@ -476,6 +477,12 @@ private void init(Vector3 P, Vector3 N) ParsingDictionary.parseTermsToId[df.ToString()] = _URI; } + protected override void RecalulateTransform() + { + Position = Point; + Rotation = Quaternion.LookRotation(Normal); + } + /// <summary> /// Bypasses initialization of new MMT %Fact by using existend URI, _which is not checked for existence_. /// <see cref="Normal"/> set to <c>Vector3.up</c> @@ -491,6 +498,8 @@ public PointFact(float a, float b, float c, string uri, FactOrganizer organizer) this.Normal = Vector3.up; this._URI = uri; _ = this.Label; + + RecalulateTransform(); } /// \copydoc Fact.parseFact(Scroll.ScrollFact) @@ -592,22 +601,7 @@ private void init(string pid, string rid) this.Pid = pid; this.Rid = rid; - Position = Point.Position; - { //Rotation - Vector3 up = Point.Normal; - Vector3 forward = Ray.Dir; - - if(Math3d.IsApproximatelyEqual(up, forward)) - { - Vector3 arbitary = Math3d.IsApproximatelyEqual(forward, Vector3.forward) - ? Vector3.right - : Vector3.forward; - - up = Vector3.Cross(arbitary, forward); - } - - Rotation = Quaternion.LookRotation(forward, up); - } + RecalulateTransform(); SOMDoc tp = new OMA( new OMS(MMT_OMS_URI.Ded), @@ -625,6 +619,26 @@ private void init(string pid, string rid) AddFactResponse.sendAdd(mmtDecl, out this._URI); } + protected override void RecalulateTransform() + { + Position = Point.Position; + { //Rotation + Vector3 up = Point.Normal; + Vector3 forward = Ray.Dir; + + if (Math3d.IsApproximatelyEqual(up, forward)) + { + Vector3 arbitary = Math3d.IsApproximatelyEqual(forward, Vector3.forward) + ? Vector3.right + : Vector3.forward; + + up = Vector3.Cross(arbitary, forward); + } + + Rotation = Quaternion.LookRotation(forward, up); + } + } + /// <summary> /// Bypasses initialization of new MMT %Fact by using existend URI, _which is not checked for existence_. /// </summary> @@ -638,6 +652,8 @@ public OnLineFact(string pid, string rid, string uri, FactOrganizer organizer) : this.Rid = rid; this._URI = uri; _ = this.Label; + + RecalulateTransform(); } /// \copydoc Fact.parseFact(Scroll.ScrollFact) @@ -769,7 +785,14 @@ private void init(string pid1, string pid2, string pid3) this.Pid3 = pid3; ComputeAngle(); // sets is_right_angle, angle + RecalulateTransform(); + + MMTDeclaration mmtDecl = generateNot90DegreeAngleDeclaration(angle, pid1, pid2, pid3); + AddFactResponse.sendAdd(mmtDecl, out this._URI); + } + protected override void RecalulateTransform() + { Position = Point2.Position; { //Rotation Vector3 from = (Point1.Position - Position).normalized; @@ -787,9 +810,6 @@ private void init(string pid1, string pid2, string pid3) Rotation = Quaternion.LookRotation(forwoard, up); } - - MMTDeclaration mmtDecl = generateNot90DegreeAngleDeclaration(angle, pid1, pid2, pid3); - AddFactResponse.sendAdd(mmtDecl, out this._URI); } /// <summary> @@ -806,9 +826,11 @@ public AngleFact(string Pid1, string Pid2, string Pid3, string backendURI, FactO this.Pid2 = Pid2; this.Pid3 = Pid3; - _ = ComputeAngle(); + ComputeAngle(); this._URI = backendURI; _ = this.Label; + + RecalulateTransform(); } public AngleFact(string Pid1, string Pid2, string Pid3, float angle, string backendURI, FactOrganizer organizer) : base(organizer) @@ -816,9 +838,12 @@ public AngleFact(string Pid1, string Pid2, string Pid3, float angle, string back this.Pid1 = Pid1; this.Pid2 = Pid2; this.Pid3 = Pid3; + this.angle = angle; this._URI = backendURI; _ = this.Label; + + RecalulateTransform(); } /// \copydoc Fact.parseFact(Scroll.ScrollFact) @@ -1042,6 +1067,13 @@ private void init(string pid1, string pid2, string pid3) this.Pid2 = pid2; this.Pid3 = pid3; + RecalulateTransform(); + + AddFactResponse.sendAdd(generateMMTDeclaration(pid1, pid2, pid3), out this._URI); + } + + protected override void RecalulateTransform() + { Position = Point2.Position; { //Rotation Vector3 from = (Point1.Position - Position).normalized; @@ -1059,8 +1091,6 @@ private void init(string pid1, string pid2, string pid3) Rotation = Quaternion.LookRotation(forwoard, up); } - - AddFactResponse.sendAdd(generateMMTDeclaration(pid1, pid2, pid3), out this._URI); } /// <summary> @@ -1079,6 +1109,8 @@ public RightAngleFact(string Pid1, string Pid2, string Pid3, string backendURI, this._URI = backendURI; _ = this.Label; + + RecalulateTransform(); } /// \copydoc Fact.parseFact(Scroll.ScrollFact) @@ -1259,6 +1291,8 @@ private void init(string lid1, string lid2) AddFactResponse.sendAdd(mmtDecl, out this._URI); } + protected override void RecalulateTransform() { } + /// <summary> /// Bypasses initialization of new MMT %Fact by using existend URI, _which is not checked for existence_. /// </summary> @@ -1273,6 +1307,8 @@ public ParallelLineFact(string Lid1, string Lid2, string backendURI, FactOrganiz this._URI = backendURI; _ = this.Label; + + RecalulateTransform(); } /// \copydoc Fact.parseFact(Scroll.ScrollFact) @@ -1452,14 +1488,20 @@ private void init(string pid1, string pid2, float radius, Vector3 normal) this.radius = radius; this.normal = normal; - Position = Point1.Position; - Rotation = Quaternion.LookRotation(normal); - LocalScale = new Vector3(radius, 1, radius); + RecalulateTransform(); MMTDeclaration mmtDecl = generateCircleFactDeclaration(pid1, pid2, radius, normal); AddFactResponse.sendAdd(mmtDecl, out this._URI); } + protected override void RecalulateTransform() + { + Position = Point1.Position; + Rotation = Quaternion.LookRotation(normal); + LocalScale = new Vector3(radius, 1, radius); + } + + /// <summary> /// Bypasses initialization of new MMT %Fact by using existend URI, _which is not checked for existence_. /// </summary> @@ -1479,6 +1521,8 @@ public CircleFact(string Pid1, string Pid2, float radius, Vector3 normal, string this._URI = backendURI; _ = this.Label; + + RecalulateTransform(); } /// <summary> @@ -1686,8 +1730,7 @@ private void init(string pid, string cid) this.Pid = pid; this.Cid = cid;; - Position = Point.Position; - Rotation = Circle.Rotation; + RecalulateTransform(); SOMDoc tp = new OMA( @@ -1705,6 +1748,12 @@ private void init(string pid, string cid) AddFactResponse.sendAdd(new MMTSymbolDeclaration(Label, tp, df), out _URI); } + protected override void RecalulateTransform() + { + Position = Point.Position; + Rotation = Circle.Rotation; + } + /// <summary> /// Bypasses initialization of new MMT %Fact by using existend URI, _which is not checked for existence_. /// </summary> @@ -1718,6 +1767,8 @@ public OnCircleFact(string pid, string cid, string uri, FactOrganizer organizer) this.Cid = cid; this._URI = uri; _ = this.Label; + + RecalulateTransform(); } /// \copydoc Fact.parseFact(Scroll.ScrollFact) @@ -1850,6 +1901,14 @@ private void init(string cid1, string rid2) this.angle = Math3d.AngleVectorPlane(Ray.Dir, Circle.normal).ToDegrees(); Math3d.LinePlaneIntersection(out intersection, Ray.Point1.Position, Ray.Dir, Circle.normal, Circle.Position); + RecalulateTransform(); + + MMTDeclaration mmtDecl = generateMMTDeclaration(angle, cid1, rid2); + AddFactResponse.sendAdd(mmtDecl, out this._URI); + } + + protected override void RecalulateTransform() + { Position = intersection; { //Rotation Vector3 from = (Circle.Position - Position).normalized; @@ -1871,9 +1930,6 @@ private void init(string cid1, string rid2) Rotation = Quaternion.LookRotation(forwoard, up); } - - MMTDeclaration mmtDecl = generateMMTDeclaration(angle, cid1, rid2); - AddFactResponse.sendAdd(mmtDecl, out this._URI); } /// <summary> @@ -1892,6 +1948,8 @@ public AngleCircleLineFact(string Cid1, string Rid2, float angle, string backend this._URI = backendURI; _ = this.Label; + + RecalulateTransform(); } /// \copydoc Fact.parseFact(Scroll.ScrollFact) @@ -2044,13 +2102,18 @@ private void init(string cid1) CircleFact cf1 = _Facts[cid1] as CircleFact; this.rad = cf1.radius; - Position = Circle.Position; - Rotation = Circle.Rotation; + RecalulateTransform(); MMTDeclaration mmtDecl = generateMMTDeclaration(cid1, this.rad); AddFactResponse.sendAdd(mmtDecl, out this._URI); } + protected override void RecalulateTransform() + { + Position = Circle.Position; + Rotation = Circle.Rotation; + } + /// <summary> /// Bypasses initialization of new MMT %Fact by using existend URI, _which is not checked for existence_. /// </summary> @@ -2063,6 +2126,8 @@ public RadiusFact(string Cid1, string backendURI, FactOrganizer organizer) : bas this._URI = backendURI; _ = this.Label; + + RecalulateTransform(); } /// \copydoc Fact.parseFact(Scroll.ScrollFact) @@ -2194,13 +2259,18 @@ private void init(string cid1) CircleFact cf1 = _Facts[cid1] as CircleFact; this.A = cf1.radius * cf1.radius * ((float)System.Math.PI); - Position = Circle.Position; - Rotation = Circle.Rotation; + RecalulateTransform(); MMTDeclaration mmtDecl = generateMMTDeclaration(cid1, this.A); AddFactResponse.sendAdd(mmtDecl, out this._URI); } + protected override void RecalulateTransform() + { + Position = Circle.Position; + Rotation = Circle.Rotation; + } + /// <summary> /// Bypasses initialization of new MMT %Fact by using existend URI, _which is not checked for existence_. /// </summary> @@ -2213,6 +2283,8 @@ public AreaCircleFact(string Cid1, string backendURI, FactOrganizer organizer) : this._URI = backendURI; _ = this.Label; + + RecalulateTransform(); } /// \copydoc Fact.parseFact(Scroll.ScrollFact) @@ -2348,13 +2420,18 @@ private void init(string cid1, string pid1, float vol) this.Pid1 = pid1; this.vol = vol; - Position = Point.Position; - Rotation = Circle.Rotation; + RecalulateTransform(); MMTDeclaration mmtDecl = generateMMTDeclaration(cid1, pid1, vol); AddFactResponse.sendAdd(mmtDecl, out this._URI); } + protected override void RecalulateTransform() + { + Position = Point.Position; + Rotation = Circle.Rotation; + } + /// <summary> /// Bypasses initialization of new MMT %Fact by using existend URI, _which is not checked for existence_. /// </summary> @@ -2371,6 +2448,8 @@ public ConeVolumeFact(string Cid1, string Pid1, float volume, string backendURI, this._URI = backendURI; _ = this.Label; + + RecalulateTransform(); } /// \copydoc Fact.parseFact(Scroll.ScrollFact) @@ -2530,6 +2609,14 @@ private void init(string cid1, string lid1) this.Lid1 = lid1; Math3d.LinePlaneIntersection(out intersection, Ray.Point1.Position, Ray.Dir, Circle.normal, Circle.Position); + RecalulateTransform(); + + MMTDeclaration mmtDecl = generateMMTDeclaration(cid1, lid1); + AddFactResponse.sendAdd(mmtDecl, out this._URI); + } + + protected override void RecalulateTransform() + { Position = intersection; { //Rotation Vector3 from = (Circle.Position - Position).normalized; @@ -2543,9 +2630,6 @@ private void init(string cid1, string lid1) Vector3 forward = (from + to).normalized; Rotation = Quaternion.LookRotation(forward, up); } - - MMTDeclaration mmtDecl = generateMMTDeclaration(cid1, lid1); - AddFactResponse.sendAdd(mmtDecl, out this._URI); } /// <summary> @@ -2562,6 +2646,8 @@ public OrthogonalCircleLineFact(string Cid1, string Lid1, string backendURI, Fac this._URI = backendURI; _ = this.Label; + + RecalulateTransform(); } /// \copydoc Fact.parseFact(Scroll.ScrollFact) @@ -2727,13 +2813,18 @@ private void init(string cid1, string cid2, float vol, string unequalproof, OMA this.unequalCirclesProof = unequalproof; this.vol = vol; - Position = Circle2.Position; - Rotation = Circle2.Rotation; + RecalulateTransform(); MMTDeclaration mmtDecl = generateMMTDeclaration(cid1, cid2, vol, unequalproof, proof); AddFactResponse.sendAdd(mmtDecl, out this._URI); } + protected override void RecalulateTransform() + { + Position = Circle2.Position; + Rotation = Circle2.Rotation; + } + /// <summary> /// Bypasses initialization of new MMT %Fact by using existend URI, _which is not checked for existence_. /// </summary> @@ -2753,6 +2844,8 @@ public TruncatedConeVolumeFact(string Cid1, string Cid2, float volume, string un this._URI = backendURI; _ = this.Label; + + RecalulateTransform(); } /// \copydoc Fact.parseFact(Scroll.ScrollFact) @@ -2917,13 +3010,18 @@ private void init(string cid1, string cid2, float vol, string eqProof, OMA proof this.equalCirclesProof = eqProof; this.vol = vol; - Position = Circle2.Position; - Rotation = Circle2.Rotation; + RecalulateTransform(); MMTDeclaration mmtDecl = generateMMTDeclaration(cid1, cid2, vol, eqProof, proof); AddFactResponse.sendAdd(mmtDecl, out this._URI); } + protected override void RecalulateTransform() + { + Position = Circle2.Position; + Rotation = Circle2.Rotation; + } + /// <summary> /// Bypasses initialization of new MMT %Fact by using existend URI, _which is not checked for existence_. /// </summary> @@ -2943,6 +3041,8 @@ public CylinderVolumeFact(string Cid1, string Cid2, float volume, string eqProof this._URI = backendURI; _ = this.Label; + + RecalulateTransform(); } /// \copydoc Fact.parseFact(Scroll.ScrollFact) @@ -3090,13 +3190,18 @@ private void init(string cid1, string cid2) this.Cid1 = cid1; this.Cid2 = cid2; - Position = Circle1.Position; - Rotation = Circle1.Rotation; + RecalulateTransform(); MMTDeclaration mmtDecl = generateEqualCirclesFactDeclaration(cid1, cid2); AddFactResponse.sendAdd(mmtDecl, out this._URI); } + protected override void RecalulateTransform() + { + Position = Circle1.Position; + Rotation = Circle1.Rotation; + } + /// <summary> /// Bypasses initialization of new MMT %Fact by using existend URI, _which is not checked for existence_. /// </summary> @@ -3111,6 +3216,8 @@ public EqualCirclesFact(string Cid1, string Cid2, string backendURI, FactOrganiz this._URI = backendURI; _ = this.Label; + + RecalulateTransform(); } /// \copydoc Fact.parseFact(Scroll.ScrollFact) @@ -3269,13 +3376,18 @@ private void init(string cid1, string cid2) this.Cid1 = cid1; this.Cid2 = cid2; - Position = Circle2.Position; - Rotation = Circle2.Rotation; + RecalulateTransform(); MMTDeclaration mmtDecl = generateUnEqualCirclesFactDeclaration(cid1, cid2); AddFactResponse.sendAdd(mmtDecl, out this._URI); } + protected override void RecalulateTransform() + { + Position = Circle2.Position; + Rotation = Circle2.Rotation; + } + /// <summary> /// Bypasses initialization of new MMT %Fact by using existend URI, _which is not checked for existence_. /// </summary> @@ -3290,6 +3402,8 @@ public UnEqualCirclesFact(string Cid1, string Cid2, string backendURI, FactOrgan this._URI = backendURI; _ = this.Label; + + RecalulateTransform(); } /// \copydoc Fact.parseFact(Scroll.ScrollFact) @@ -3450,6 +3564,8 @@ private void init() // AddFactResponse.sendAdd(mmtDecl, out this._URI); } + protected override void RecalulateTransform() { } + /// <summary> /// Bypasses initialization of new MMT %Fact by using existend URI, _which is not checked for existence_. /// </summary> diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FactSpawner.cs b/Assets/Scripts/InteractionEngine/FactHandling/FactSpawner.cs index 7150d6011abbc8902098fcc5cfb1588a60ff64ba..ec6fa18a34f826e59b9d51520f20ff082288ce44 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FactSpawner.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FactSpawner.cs @@ -62,16 +62,10 @@ public Fact SpawnLine(Fact fact) GameObject line = GameObject.Instantiate(Line); //Place the Line in the centre of the two points line.transform.position = lineFact.Position; - //Change scale and rotation, so that the two points are connected by the line - //Get the Line-GameObject as the first Child of the Line-Prefab -> That's the Collider - var v3T = line.transform.GetChild(0).localScale; - - //For every Coordinate x,y,z we have to devide it by the LocalScale of the Child, - //because actually the Child should be of this length and not the parent, which is only the Collider - v3T.x = lineFact.LocalScale.x / line.transform.GetChild(0).GetChild(0).localScale.x; - //Change Scale/Rotation of the Line-GameObject without affecting Scale of the Text - line.transform.GetChild(0).localScale = v3T; + //Change scale and rotation, so that the two points are connected by the line + //and without affecting Scale of the Text + line.transform.GetChild(0).localScale = lineFact.LocalScale; line.transform.GetChild(0).rotation = lineFact.Rotation; line.GetComponentInChildren<TextMeshPro>().text = @@ -90,16 +84,10 @@ public Fact SpawnRay(Fact fact) GameObject line = GameObject.Instantiate(Ray); //Place the Line in the centre of the two points line.transform.position = rayFact.Position; - //Change scale and rotation, so that the two points are connected by the line - //Get the Line-GameObject as the first Child of the Line-Prefab -> That's the Collider - var v3T = line.transform.GetChild(0).localScale; - - //For every Coordinate x,y,z we have to devide it by the LocalScale of the Child, - //because actually the Child should be of this length and not the parent, which is only the Collider - v3T.x = rayFact.LocalScale.x / line.transform.GetChild(0).GetChild(0).localScale.x; - //Change Scale/Rotation of the Line-GameObject without affecting Scale of the Text - line.transform.GetChild(0).localScale = v3T; + //Change scale and rotation, so that the two points are connected by the line + //and without affecting Scale of the Text + line.transform.GetChild(0).localScale = rayFact.LocalScale; line.transform.GetChild(0).rotation = rayFact.Rotation; line.GetComponentInChildren<TextMeshPro>().text = rayFact.Label; diff --git a/Assets/Scripts/InteractionEngine/FactHandling/FunctionFact.cs b/Assets/Scripts/InteractionEngine/FactHandling/FunctionFact.cs index 79485fc8de16833cdce2b568fdc4c4f5a5476376..fce41a9b234e245e663e3dcb5ce4654807fdd16d 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/FunctionFact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/FunctionFact.cs @@ -91,6 +91,8 @@ private void init(SOMDoc Function_SOMDoc, (T0, T0) domain) //ParsingDictionary.parseTermsToId[df.ToString()] = _URI; } + protected override void RecalulateTransform() { } + /// \copydoc Fact.parseFact(Scroll.ScrollFact) public new static FunctionFact<T0, TResult> parseFact(Scroll.ScrollFact fact) {// TODO Correctness diff --git a/Assets/Scripts/InteractionEngine/ShinyThings.cs b/Assets/Scripts/InteractionEngine/ShinyThings.cs index 39781b0e58dbef1c964eda471a4f59786884070a..4be58172dadf90d03b6ab2905becc641544d11f2 100644 --- a/Assets/Scripts/InteractionEngine/ShinyThings.cs +++ b/Assets/Scripts/InteractionEngine/ShinyThings.cs @@ -85,6 +85,9 @@ void ApplyMaterial(FactObject root, Material new_mat) => public static void HighlightFact(Fact startFact, FactObject.FactMaterials tmp_mat) { + if (startFact.Representation == null) + return; + FactObject selected_fact_obj = startFact.Representation.GetComponentInChildren<FactObject>(); selected_fact_obj.CoroutineCascadeForChildrenAllRenderer( diff --git a/Assets/Scripts/MeshGenerator/CircleGenerator.cs b/Assets/Scripts/MeshGenerator/CircleGenerator.cs index 58c302851e4916b01300aa6eadc436a1f5e20420..6d81d959d8ab9a9c50b2d252f847743a5dcda0d1 100644 --- a/Assets/Scripts/MeshGenerator/CircleGenerator.cs +++ b/Assets/Scripts/MeshGenerator/CircleGenerator.cs @@ -20,6 +20,8 @@ public class CircleGenerator : ShapeGenerator #region Implementation protected override void GenerateShape() { + if (circleMesh == null) return; + var circle = CreateCircle(radius, sideCount); if (circleMesh.sharedMesh != null) diff --git a/Assets/Scripts/UI/HideUI_mobile.cs b/Assets/Scripts/UI/HideUI_mobile.cs index c48c2dfd7788ba1c7af7b4812c380eb05e1b3d35..7b93f8aca11be30d92783fdde752af3b9dda0011 100644 --- a/Assets/Scripts/UI/HideUI_mobile.cs +++ b/Assets/Scripts/UI/HideUI_mobile.cs @@ -20,7 +20,7 @@ public string modreset, modsave, modload, - modfire; + modfire = "Fire1"; public string toolMode_keyBind; public string MathMode_keyBind;