From 3b340f7164d7d08c03fedf81e7cc27c293c3238d Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 30 Apr 2020 22:09:42 -0400 Subject: [PATCH] Better physics --- core/src/mindustry/async/PhysicsProcess.java | 13 ++++++------- core/src/mindustry/content/UnitTypes.java | 3 ++- gradle.properties | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/src/mindustry/async/PhysicsProcess.java b/core/src/mindustry/async/PhysicsProcess.java index b3765976d4..7fcf9a05c2 100644 --- a/core/src/mindustry/async/PhysicsProcess.java +++ b/core/src/mindustry/async/PhysicsProcess.java @@ -13,7 +13,7 @@ public class PhysicsProcess implements AsyncProcess{ private Array refs = new Array<>(false); private BodyDef def; - private EntityGroup group; + private EntityGroup group; private Filter flying = new Filter(){{ maskBits = categoryBits = 2; }}, ground = new Filter(){{ @@ -44,17 +44,17 @@ public class PhysicsProcess implements AsyncProcess{ }); //find entities without bodies and assign them - for(Hitboxc entity : group){ - boolean grounded = ((Flyingc)entity).isGrounded(); + for(Unitc entity : group){ + boolean grounded = entity.isGrounded(); if(entity.body() == null){ //add bodies to entities that have none CircleShape shape = new CircleShape(); - shape.setRadius(entity.hitSize() * 0.46f); + shape.setRadius(entity.hitSize() / 2f); FixtureDef fd = new FixtureDef(); fd.shape = shape; - fd.density = 10.0f; + fd.density = 5.0f * entity.mass(); fd.restitution = 0.05f; fd.filter.maskBits = fd.filter.categoryBits = (grounded ? ground : flying).maskBits; @@ -62,7 +62,6 @@ public class PhysicsProcess implements AsyncProcess{ Body body = physics.createBody(def); body.createFixture(fd); - body.setUserData(entity); PhysicRef ref = new PhysicRef(entity, body); @@ -101,7 +100,7 @@ public class PhysicsProcess implements AsyncProcess{ ref.body.setLinearVelocity(ref.velocity); } - physics.step(Core.graphics.getDeltaTime(), 3, 3); + physics.step(Core.graphics.getDeltaTime(), 8, 8); //get delta vectors for(PhysicRef ref : refs){ diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index db72ff1271..d610376b59 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -89,11 +89,12 @@ public class UnitTypes implements ContentList{ speed = 1f; accel = 0.08f; drag = 0f; - mass = 2f; + mass = 30f; flying = true; health = 75000; engineOffset = 40; engineSize = 7.3f; + hitsize = 58f; weapons.add(new Weapon(){{ y = 1.5f; diff --git a/gradle.properties b/gradle.properties index 973f5c2699..5ea44d9c93 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=3533846d0009cda47c9416c4cb105b8e79518099 +archash=9fc6cd8c90e0665cc3a583879b2007fe29fbc929