refined controls

This commit is contained in:
2023-02-06 22:41:47 +00:00
parent f4d08bcacb
commit cdff383a7a
4 changed files with 58 additions and 11 deletions

View File

@@ -85,14 +85,20 @@ void querylistbodies(cpBody *body, void *data)
int *phys2d_query_box(cpVect pos, cpVect wh)
{
cpBB bbox = cpBBNewForExtents(pos, wh.x, wh.y);
cpShape *box = cpBoxShapeNew2(NULL, bbox, 0.f);
cpShape *box = cpBoxShapeNew(NULL, wh.x, wh.y, 0.f);
cpTransform T = {0};
T.a = 1;
T.d = 1;
T.tx = pos.x;
T.ty = pos.y;
cpShapeUpdate(box, T);
cpBB bbox = cpShapeGetBB(box);
if (qhits) arrfree(qhits);
cpSpaceShapeQuery(space, box, querylist, NULL);
YughInfo("FInished query.");
cpSpaceEachBody(space, querylistbodies, &bbox);
cpShapeFree(box);