Skip to content

Commit

Permalink
Ignore Collider:setKinematic if Collider's shape must be static;
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornbytes committed May 10, 2024
1 parent c657441 commit 6a958a4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/modules/physics/physics_jolt.c
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,9 @@ bool lovrColliderIsKinematic(Collider* collider) {
}

void lovrColliderSetKinematic(Collider* collider, bool kinematic) {
if (collider->tag == ~0u || (collider->world->staticTagMask & (1 << collider->tag)) == 0) {
bool mustBeStatic = JPH_Shape_MustBeStatic(collider->shape->handle);
bool hasStaticTag = collider->tag != ~0u && (collider->world->staticTagMask & (1 << collider->tag));
if (!mustBeStatic && !hasStaticTag) {
JPH_MotionType motionType = kinematic ? JPH_MotionType_Kinematic : JPH_MotionType_Dynamic;
JPH_BodyInterface_SetMotionType(collider->world->bodies, collider->id, motionType, JPH_Activation_DontActivate);
}
Expand Down

0 comments on commit 6a958a4

Please sign in to comment.