diff --git a/core/src/mindustry/async/PhysicsProcess.java b/core/src/mindustry/async/PhysicsProcess.java index 1a85312e55..97c6d747b8 100644 --- a/core/src/mindustry/async/PhysicsProcess.java +++ b/core/src/mindustry/async/PhysicsProcess.java @@ -129,6 +129,7 @@ public class PhysicsProcess implements AsyncProcess{ private final Seq seq = new Seq<>(PhysicsBody.class); private final Rect rect = new Rect(); private final Vec2 vec = new Vec2(); + private final Rand rand = new Rand(); public PhysicsWorld(Rect bounds){ for(int i = 0; i < layers; i++){ @@ -180,7 +181,14 @@ public class PhysicsProcess implements AsyncProcess{ float dst = Mathf.dst(body.x, body.y, other.x, other.y); if(dst < rs){ - vec.set(body.x - other.x, body.y - other.y).setLength(rs - dst); + vec.set(body.x - other.x, body.y - other.y); + + if(vec.isZero()){ //exact stacked bodies will move in random directions away from each other + vec.trns(rand.random(360f), rs - dst); + }else{ + vec.setLength(rs - dst); + } + float ms = body.mass + other.mass; float m1 = other.mass / ms, m2 = body.mass / ms; diff --git a/core/src/mindustry/input/MobileInput.java b/core/src/mindustry/input/MobileInput.java index a5b262c2d9..b5019d2535 100644 --- a/core/src/mindustry/input/MobileInput.java +++ b/core/src/mindustry/input/MobileInput.java @@ -752,6 +752,9 @@ public class MobileInput extends InputHandler implements GestureListener{ if(!commandMode){ queueCommandMode = false; + }else{ + mode = none; + schematicMode = false; } //cannot rebuild and place at the same time