bounds check ChainShape:getPoint, and make functions that take indices 1-indexed on the Lua end of things

This commit is contained in:
Bill Meltsner
2012-02-04 19:38:11 -05:00
parent 83f7002f67
commit ddb1492c1f
4 changed files with 11 additions and 7 deletions
+2 -2
View File
@@ -100,7 +100,7 @@ namespace box2d
float x = Physics::scaleDown((float)luaL_checknumber(L, 6));
float y = Physics::scaleDown((float)luaL_checknumber(L, 7));
float r = (float)luaL_checknumber(L, 8);
int childIndex = (int)luaL_optint(L, 9, 0);
int childIndex = (int)luaL_optint(L, 9, 1) - 1; // Convert from 1-based index
b2RayCastInput input;
input.p1.Set(p1x, p1y);
input.p2.Set(p2x, p2y);
@@ -120,7 +120,7 @@ namespace box2d
float x = Physics::scaleDown((float)luaL_checknumber(L, 1));
float y = Physics::scaleDown((float)luaL_checknumber(L, 2));
float r = (float)luaL_checknumber(L, 3);
int childIndex = (int)luaL_optint(L, 4, 0);
int childIndex = (int)luaL_optint(L, 4, 1) - 1; // Convert from 1-based index
b2Transform transform(b2Vec2(x, y), b2Rot(r));
b2AABB box;
shape->ComputeAABB(&box, transform, childIndex);