mirror of
https://github.com/love2d/love.git
synced 2026-08-19 20:19:42 +02:00
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.
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user