mirror of https://github.com/bjornbytes/lovr.git
CompoundShape:replaceShape fixes;
This commit is contained in:
parent
e36374c4cf
commit
582ee1625f
|
@ -402,7 +402,7 @@ static int l_lovrCompoundShapeAddShape(lua_State* L) {
|
|||
|
||||
static int l_lovrCompoundShapeReplaceShape(lua_State* L) {
|
||||
CompoundShape* shape = luax_checktype(L, 1, CompoundShape);
|
||||
uint32_t index = luax_checku32(L, 2);
|
||||
uint32_t index = luax_checku32(L, 2) - 1;
|
||||
Shape* child = luax_checkshape(L, 3);
|
||||
float position[3], orientation[4];
|
||||
int i = 4;
|
||||
|
|
|
@ -1041,6 +1041,7 @@ void lovrCompoundShapeReplaceShape(CompoundShape* shape, uint32_t index, Shape*
|
|||
lovrCheck(child != shape, "Don't put a CompoundShape inside itself! lol");
|
||||
JPH_Vec3 pos = { position[0], position[1], position[2] };
|
||||
JPH_Quat rot = { orientation[0], orientation[1], orientation[2], orientation[3] };
|
||||
lovrRelease(lovrCompoundShapeGetShape(shape, index), lovrShapeDestroy);
|
||||
JPH_MutableCompoundShape_ModifyShape2((JPH_MutableCompoundShape*) shape->shape, index, &pos, &rot, child->shape);
|
||||
lovrRetain(child);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue