newCollider takes optional Shape as first arg;

This commit is contained in:
bjorn 2024-04-05 18:44:04 -07:00
parent 24708f7114
commit 1a8d05b8b4
1 changed files with 3 additions and 2 deletions

View File

@ -102,9 +102,10 @@ static bool queryCallback(Collider* collider, uint32_t shape, void* userdata) {
static int l_lovrWorldNewCollider(lua_State* L) {
World* world = luax_checktype(L, 1, World);
Shape* shape = luax_totype(L, 2, Shape);
float position[3];
luax_readvec3(L, 2, position, NULL);
Collider* collider = lovrColliderCreate(world, NULL, position[0], position[1], position[2]);
luax_readvec3(L, 2 + !!shape, position, NULL);
Collider* collider = lovrColliderCreate(world, shape, position[0], position[1], position[2]);
luax_pushtype(L, Collider, collider);
lovrRelease(collider, lovrColliderDestroy);
return 1;