From 9c7f970501903fb6133b601638f34a8df81697e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Pastuszak?= Date: Thu, 12 Nov 2015 20:10:40 +0100 Subject: [PATCH] Fix sprite rotation ignored, #58 --- Runtime/CHANGES | 1 + .../kotcrab/vis/runtime/system/physics/PhysicsBodyManager.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Runtime/CHANGES b/Runtime/CHANGES index 815d23ff3..e588b7153 100644 --- a/Runtime/CHANGES +++ b/Runtime/CHANGES @@ -1,4 +1,5 @@ [0.2.6] [LibGDX 1.7.0] [Artemis 0.13.1] [Snapshot] +-Fixed rotation of sprite ignored when creating physics body [0.2.5] [LibGDX 1.7.0] [Artemis 0.13.1] -Updated to Artemis 0.13.1, LibGDX 1.7.0 diff --git a/Runtime/src/com/kotcrab/vis/runtime/system/physics/PhysicsBodyManager.java b/Runtime/src/com/kotcrab/vis/runtime/system/physics/PhysicsBodyManager.java index 2050282b1..95603083d 100644 --- a/Runtime/src/com/kotcrab/vis/runtime/system/physics/PhysicsBodyManager.java +++ b/Runtime/src/com/kotcrab/vis/runtime/system/physics/PhysicsBodyManager.java @@ -20,6 +20,7 @@ import com.artemis.Entity; import com.artemis.Manager; import com.artemis.annotations.Wire; +import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.physics.box2d.*; import com.kotcrab.vis.runtime.component.PhysicsComponent; @@ -59,6 +60,7 @@ public void added (int entityId) { BodyDef bodyDef = new BodyDef(); bodyDef.position.set(worldPos); + bodyDef.angle = MathUtils.degreesToRadians * sprite.getRotation(); Body body = world.createBody(bodyDef); body.setType(physicsProperties.bodyType);