Преглед изворни кода

2D Physics bodies now set correct rotation in child entities

Ivan Safrin пре 10 година
родитељ
комит
956f3f216c
1 измењених фајлова са 5 додато и 1 уклоњено
  1. 5 1
      Modules/Contents/2DPhysics/Source/PolyPhysicsScreenEntity.cpp

+ 5 - 1
Modules/Contents/2DPhysics/Source/PolyPhysicsScreenEntity.cpp

@@ -47,7 +47,11 @@ PhysicsScene2DEntity::PhysicsScene2DEntity(Entity *entity, b2World *world, Numbe
 	// Create body definition---------------------------------------
 	b2BodyDef bodyDef;
 	bodyDef.position.Set(compoundMatrix.getPosition().x/worldScale, compoundMatrix.getPosition().y/worldScale);
-	bodyDef.angle = entity->getRoll()*(PI/180.0f);	
+    
+    Number ax,ay,az;
+    compoundMatrix.getEulerAngles(&ax, &ay, &az);
+    
+	bodyDef.angle = az*(PI/180.0f);
 	bodyDef.bullet = isSensor;	
 	bodyDef.fixedRotation = fixedRotation;	
 	if(isStatic)