Collider shape is required I think;

Jolt doesn't really support bodies without shapes.
This commit is contained in:
bjorn 2024-04-04 21:52:51 -07:00
parent 930e713079
commit 051266f8ea
2 changed files with 3 additions and 21 deletions

View File

@ -27,22 +27,14 @@ static int l_lovrColliderGetWorld(lua_State* L) {
static int l_lovrColliderGetShape(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
Shape* shape = lovrColliderGetShape(collider);
if (shape) {
luax_pushshape(L, shape);
} else {
lua_pushnil(L);
}
luax_pushshape(L, shape);
return 1;
}
static int l_lovrColliderSetShape(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
if (lua_isnoneornil(L, 2)) {
lovrColliderSetShape(collider, NULL);
} else {
Shape* shape = luax_checkshape(L, 2);
lovrColliderSetShape(collider, shape);
}
Shape* shape = luax_checkshape(L, 2);
lovrColliderSetShape(collider, shape);
return 0;
}

View File

@ -426,12 +426,6 @@ void lovrColliderSetShape(Collider* collider, Shape* shape) {
}
void lovrColliderGetShapeOffset(Collider* collider, float* position, float* orientation) {
if (!collider->shape) {
vec3_set(position, 0.f, 0.f, 0.f);
quat_identity(orientation);
return;
}
const JPH_Shape* shape = JPH_BodyInterface_GetShape(collider->world->body_interface, collider->id);
if (JPH_Shape_GetSubType(shape) == JPH_ShapeSubType_RotatedTranslated) {
@ -448,10 +442,6 @@ void lovrColliderGetShapeOffset(Collider* collider, float* position, float* orie
}
void lovrColliderSetShapeOffset(Collider* collider, float* position, float* orientation) {
if (!collider->shape) {
return;
}
const JPH_Shape* shape = JPH_BodyInterface_GetShape(collider->world->body_interface, collider->id);
if (JPH_Shape_GetSubType(shape) == JPH_ShapeSubType_RotatedTranslated) {