diff options
author | Jaime van Kessel <nallath@gmail.com> | 2016-08-19 12:21:49 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2016-08-19 12:21:49 +0300 |
commit | a01a541c5d9728a596fd4fc0d6a0709060d22877 (patch) | |
tree | a07782dc447c9a57e99994115ecd52954c37c6f7 /cura/PlatformPhysics.py | |
parent | e3d4a33954f19f8de1d1d5d92b5335aa7bbcdc37 (diff) |
When two nodes overlap, only one is pushed free
Fixes CURA-2137
Diffstat (limited to 'cura/PlatformPhysics.py')
-rw-r--r-- | cura/PlatformPhysics.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cura/PlatformPhysics.py b/cura/PlatformPhysics.py index 56daaddc18..32d541f8d6 100644 --- a/cura/PlatformPhysics.py +++ b/cura/PlatformPhysics.py @@ -41,6 +41,10 @@ class PlatformPhysics: root = self._controller.getScene().getRoot() + # Keep a list of nodes that are moving. We use this so that we don't move two intersecting objects in the + # same direction. + transformed_nodes = [] + for node in BreadthFirstIterator(root): if node is root or type(node) is not SceneNode or node.getBoundingBox() is None: continue @@ -91,6 +95,9 @@ class PlatformPhysics: if not other_node.callDecoration("getConvexHull") or not other_node.getBoundingBox(): continue + if other_node in transformed_nodes: + continue # Other node is already moving, wait for next pass. + # Get the overlap distance for both convex hulls. If this returns None, there is no intersection. head_hull = node.callDecoration("getConvexHullHead") if head_hull: @@ -125,6 +132,7 @@ class PlatformPhysics: node._outside_buildarea = True if not Vector.Null.equals(move_vector, epsilon=1e-5): + transformed_nodes.append(node) op = PlatformPhysicsOperation.PlatformPhysicsOperation(node, move_vector) op.push() |