diff --git a/Assets/Plugins/NaturePackLite/Prefabs/Tree_01.prefab b/Assets/Plugins/NaturePackLite/Prefabs/Tree_01.prefab index 652b114e7d528825f8791551554628d9f3ddaf3b..d63ec606ee001bb5931444b276b9ae749f4cf4b0 100644 --- a/Assets/Plugins/NaturePackLite/Prefabs/Tree_01.prefab +++ b/Assets/Plugins/NaturePackLite/Prefabs/Tree_01.prefab @@ -141,7 +141,7 @@ SphereCollider: m_IsTrigger: 0 m_Enabled: 1 serializedVersion: 2 - m_Radius: 0.4 + m_Radius: 0.5 m_Center: {x: 0, y: 0, z: 0} --- !u!33 &933372636075482527 MeshFilter: diff --git a/Assets/Resources/Prefabs/Angle.prefab b/Assets/Resources/Prefabs/Angle.prefab index 32725c942e941a86d16988814617814ef214d0a5..201b2d0987098b8406d247b85343c786b7c57503 100644 --- a/Assets/Resources/Prefabs/Angle.prefab +++ b/Assets/Resources/Prefabs/Angle.prefab @@ -184,7 +184,7 @@ GameObject: - component: {fileID: 3394522495515098203} - component: {fileID: 3394522495515098196} - component: {fileID: 7137147696081341476} - m_Layer: 0 + m_Layer: 12 m_Name: AngleOuter m_TagString: Untagged m_Icon: {fileID: 0} @@ -310,7 +310,7 @@ GameObject: - component: {fileID: 3394522496185282006} - component: {fileID: 3394522496185282007} - component: {fileID: 2270583313952035853} - m_Layer: 0 + m_Layer: 12 m_Name: AngleInner m_TagString: Untagged m_Icon: {fileID: 0} @@ -431,9 +431,9 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 5781467132517744785} - m_Layer: 0 + m_Layer: 12 m_Name: Angle - m_TagString: Untagged + m_TagString: Selectable m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 diff --git a/Assets/Scripts/InteractionEngine/Fact.cs b/Assets/Scripts/InteractionEngine/Fact.cs index 84c42faeb213adb5ef08db5b70cd33b0e9b9cd5e..6ea47ee48adefc75baf66805bb11180c8646f0de 100644 --- a/Assets/Scripts/InteractionEngine/Fact.cs +++ b/Assets/Scripts/InteractionEngine/Fact.cs @@ -399,8 +399,7 @@ public override GameObject instantiateDisplay(GameObject prefab, Transform trans protected override bool EquivalentWrapped(RayFact f1, RayFact f2) { - // TODO! check for similar(float uncertanty!) Directions - if (f1.Dir != f2.Dir && f1.Dir != -f2.Dir) + if (!Math3d.IsApproximatelyParallel(f1.Dir, f2.Dir)) return false; PointFact p1f1 = (PointFact)Facts[f1.Pid1]; diff --git a/Assets/Scripts/InteractionEngine/FactOrganizer.cs b/Assets/Scripts/InteractionEngine/FactOrganizer.cs index bf83ad6b7404cff7b74194695253f3fa115378a4..fdaa902e11b96df62a6748cf4ce160214574d3d1 100644 --- a/Assets/Scripts/InteractionEngine/FactOrganizer.cs +++ b/Assets/Scripts/InteractionEngine/FactOrganizer.cs @@ -109,7 +109,7 @@ private bool FindEquivalent(Fact search, out Fact found) } private void WorkflowAdd(stepnote note) - // adds Workflow; updates meta struct; Invokes Events + // prunes & adds Workflow; updates meta struct; Invokes Events { PruneWorkflow(); @@ -154,6 +154,13 @@ private void PruneWorkflow() base.Remove(last.Id); MetaInf.Remove(last.Id); } + else + // update active status + { + meta inf = MetaInf[last.Id]; + inf.active = !last.creation; + MetaInf[last.Id] = inf; + } } // prune Worklfow down to marker @@ -231,7 +238,7 @@ public bool Remove(int key, bool samestep = false) // TODO: MMT: decide dependencies there (remember virtual deletions in Unity (un-redo)!) // TODO? decrease runtime from O(n/2) - private bool safe_dependencies(int key, out List<int> dependencies) + public bool safe_dependencies(int key, out List<int> dependencies) // searches for dependencies of a Fact; returns false if any dependencies are steproots // int key: Fact to be deleted // out List<int> dependencies: dependencyList diff --git a/Assets/Scripts/Math3d.cs b/Assets/Scripts/Math3d.cs index b6cf776eef642a9fe8c2bb31df31e9c17a98a01b..73156d61f7c638b7db57178e8956e69027c5a9bf 100644 --- a/Assets/Scripts/Math3d.cs +++ b/Assets/Scripts/Math3d.cs @@ -534,7 +534,7 @@ public static bool IsPointOnLine(Vector3 linePoint, Vector3 lineVec, Vector3 poi } //This function returns true if a point is approximately on a line. - //The line is regarded infinite. + //The line is regarded as being infinite. public static bool IsPointApproximatelyOnLine(Vector3 linePoint, Vector3 lineVec, Vector3 point, double precission = Math3d.vectorPrecission) { @@ -543,7 +543,17 @@ public static bool IsPointApproximatelyOnLine(Vector3 linePoint, Vector3 lineVec double t = Vector3.Dot(linePointToPoint.normalized, lineVec); - return Math.Abs(t - 1d) < precission || Math.Abs(t) < precission; + return Math.Abs(Math.Abs(t) - 1d) < precission || Math.Abs(t) < precission; + } + + //This function returns true if two Vector3s are approximately parallel + public static bool IsApproximatelyParallel(Vector3 vectorA, Vector3 vectorB, double precission = Math3d.vectorPrecission) + { + //SqrMagnitude(Abs(vectorA) - Abs(vectorB)) < precission + return Math.Pow(Math.Abs(vectorA.x) - Math.Abs(vectorB.x), 2) + + Math.Pow(Math.Abs(vectorA.y) - Math.Abs(vectorB.y), 2) + + Math.Pow(Math.Abs(vectorA.z) - Math.Abs(vectorB.z), 2) + < precission; } //This function returns a point which is a projection from a point to a line segment.