Fixed #11240
This commit is contained in:
@@ -129,6 +129,7 @@ public class PhysicsProcess implements AsyncProcess{
|
|||||||
private final Seq<PhysicsBody> seq = new Seq<>(PhysicsBody.class);
|
private final Seq<PhysicsBody> seq = new Seq<>(PhysicsBody.class);
|
||||||
private final Rect rect = new Rect();
|
private final Rect rect = new Rect();
|
||||||
private final Vec2 vec = new Vec2();
|
private final Vec2 vec = new Vec2();
|
||||||
|
private final Rand rand = new Rand();
|
||||||
|
|
||||||
public PhysicsWorld(Rect bounds){
|
public PhysicsWorld(Rect bounds){
|
||||||
for(int i = 0; i < layers; i++){
|
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);
|
float dst = Mathf.dst(body.x, body.y, other.x, other.y);
|
||||||
|
|
||||||
if(dst < rs){
|
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 ms = body.mass + other.mass;
|
||||||
float m1 = other.mass / ms, m2 = body.mass / ms;
|
float m1 = other.mass / ms, m2 = body.mass / ms;
|
||||||
|
|
||||||
|
|||||||
@@ -752,6 +752,9 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
|
|
||||||
if(!commandMode){
|
if(!commandMode){
|
||||||
queueCommandMode = false;
|
queueCommandMode = false;
|
||||||
|
}else{
|
||||||
|
mode = none;
|
||||||
|
schematicMode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//cannot rebuild and place at the same time
|
//cannot rebuild and place at the same time
|
||||||
|
|||||||
Reference in New Issue
Block a user