Browse Source

remove scaling for density.

while technically density is (according to the Box2D docs) in kg/m^2, it seems like a number that can be safely left un-scaled, for simplicity's sake; the concept of a shape/fixture's density seems sufficiently divorced from the MKS system as to render this a non-issue. if this proves to be a problem in use, scaling can be re-added.
Bill Meltsner 13 years ago
parent
commit
dac757b688
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/modules/physics/box2d/Shape.cpp

+ 2 - 2
src/modules/physics/box2d/Shape.cpp

@@ -134,14 +134,14 @@ namespace box2d
 
 
 	int Shape::computeMass(lua_State * L) const
 	int Shape::computeMass(lua_State * L) const
 	{
 	{
-		float density = Physics::scaleDown((float)luaL_checknumber(L, 1));
+		float density = (float)luaL_checknumber(L, 1);
 		b2MassData data;
 		b2MassData data;
 		shape->ComputeMass(&data, density);
 		shape->ComputeMass(&data, density);
 		b2Vec2 center = Physics::scaleUp(data.center);
 		b2Vec2 center = Physics::scaleUp(data.center);
 		lua_pushnumber(L, center.x);
 		lua_pushnumber(L, center.x);
 		lua_pushnumber(L, center.y);
 		lua_pushnumber(L, center.y);
 		lua_pushnumber(L, data.mass);
 		lua_pushnumber(L, data.mass);
-		lua_pushnumber(L, data.I);
+		lua_pushnumber(L, Physics::scaleUp(Physics::scaleUp(data.I)));
 		return 4;
 		return 4;
 	}
 	}