mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-07-07 22:31:47 +08:00
When two nodes overlap, only one is pushed free
Fixes CURA-2137
This commit is contained in:
parent
e3d4a33954
commit
a01a541c5d
@ -41,6 +41,10 @@ class PlatformPhysics:
|
|||||||
|
|
||||||
root = self._controller.getScene().getRoot()
|
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):
|
for node in BreadthFirstIterator(root):
|
||||||
if node is root or type(node) is not SceneNode or node.getBoundingBox() is None:
|
if node is root or type(node) is not SceneNode or node.getBoundingBox() is None:
|
||||||
continue
|
continue
|
||||||
@ -91,6 +95,9 @@ class PlatformPhysics:
|
|||||||
if not other_node.callDecoration("getConvexHull") or not other_node.getBoundingBox():
|
if not other_node.callDecoration("getConvexHull") or not other_node.getBoundingBox():
|
||||||
continue
|
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.
|
# Get the overlap distance for both convex hulls. If this returns None, there is no intersection.
|
||||||
head_hull = node.callDecoration("getConvexHullHead")
|
head_hull = node.callDecoration("getConvexHullHead")
|
||||||
if head_hull:
|
if head_hull:
|
||||||
@ -125,6 +132,7 @@ class PlatformPhysics:
|
|||||||
node._outside_buildarea = True
|
node._outside_buildarea = True
|
||||||
|
|
||||||
if not Vector.Null.equals(move_vector, epsilon=1e-5):
|
if not Vector.Null.equals(move_vector, epsilon=1e-5):
|
||||||
|
transformed_nodes.append(node)
|
||||||
op = PlatformPhysicsOperation.PlatformPhysicsOperation(node, move_vector)
|
op = PlatformPhysicsOperation.PlatformPhysicsOperation(node, move_vector)
|
||||||
op.push()
|
op.push()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user