From ffbe66896d158b17502d8c8b8bb4a5f72589153c Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 29 Apr 2015 18:22:48 +0200 Subject: [PATCH] Scale down too large models --- PlatformPhysics.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PlatformPhysics.py b/PlatformPhysics.py index a1217c1953..d422001c85 100644 --- a/PlatformPhysics.py +++ b/PlatformPhysics.py @@ -3,6 +3,7 @@ from PyQt5.QtCore import QTimer from UM.Scene.SceneNode import SceneNode from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator from UM.Operations.TranslateOperation import TranslateOperation +from UM.Operations.ScaleToBoundsOperation import ScaleToBoundsOperation from UM.Math.Float import Float from UM.Math.Vector import Vector from UM.Math.AxisAlignedBox import AxisAlignedBox @@ -76,10 +77,13 @@ class PlatformPhysics: if overlap is None: continue - print(overlap) move_vector.setX(-overlap[0]) move_vector.setZ(-overlap[1]) if move_vector != Vector(): op = PlatformPhysicsOperation(node, move_vector) op.push() + + if node.getBoundingBox().intersectsBox(self._build_volume.getBoundingBox()) == AxisAlignedBox.IntersectionResult.FullIntersection: + op = ScaleToBoundsOperation(node, self._build_volume.getBoundingBox()) + op.push()