diff --git a/projects/parametergame/core/src/be/howest/twentytwo/parametergame/model/physics/events/LinearForceEvent.java b/projects/parametergame/core/src/be/howest/twentytwo/parametergame/model/physics/events/LinearForceEvent.java index e49a3e5..8975005 100644 --- a/projects/parametergame/core/src/be/howest/twentytwo/parametergame/model/physics/events/LinearForceEvent.java +++ b/projects/parametergame/core/src/be/howest/twentytwo/parametergame/model/physics/events/LinearForceEvent.java @@ -1,5 +1,7 @@ package be.howest.twentytwo.parametergame.model.physics.events; +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.physics.box2d.Body; @@ -16,10 +18,12 @@ public LinearForceEvent(Body unit, float force) { @Override public void execute() { - unit.applyForceToCenter( - new Vector2((float) (force * Math.sin(unit.getAngle())), (float) (force * Math.cos(unit.getAngle()))), - true); + //this.force = 1f; + Vector2 forceVector = new Vector2(force * MathUtils.cos(unit.getAngle() + MathUtils.PI/2), force + * MathUtils.sin(unit.getAngle() + MathUtils.PI/2)); + Gdx.app.log("LFE", "angle: " + unit.getAngle()); + Gdx.app.log("LinearForceEvent", "F: " + forceVector.toString()); + unit.applyForceToCenter(forceVector, true); super.execute(); } - } diff --git a/projects/parametergame/core/src/be/howest/twentytwo/parametergame/screen/GameScreen.java b/projects/parametergame/core/src/be/howest/twentytwo/parametergame/screen/GameScreen.java index 7b336b2..ad30421 100644 --- a/projects/parametergame/core/src/be/howest/twentytwo/parametergame/screen/GameScreen.java +++ b/projects/parametergame/core/src/be/howest/twentytwo/parametergame/screen/GameScreen.java @@ -242,7 +242,7 @@ private Entity createShip() { bodyDef.position.set(40f, 45f); Body rigidBody = world.createBody(bodyDef); // Put in world bodyComponent.setBody(rigidBody); - rigidBody.applyForceToCenter(new Vector2(0f, -2500f), true); + //rigidBody.applyForceToCenter(new Vector2(0f, -2500f), true); rigidBody.setLinearDamping(0.1f); // Air resistance type effect