Skip to content

Commit

Permalink
Fix Shape:getInertia;
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornbytes committed May 3, 2024
1 parent 979dd04 commit 010ffee
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/modules/physics/physics_jolt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1375,7 +1375,14 @@ void lovrShapeGetInertia(Shape* shape, float diagonal[3], float rotation[4]) {
return;
}

// eigenvalue decomposition ^^
JPH_MassProperties properties;
JPH_Shape_GetMassProperties(shape->handle, &properties);

JPH_Vec3 d;
JPH_Matrix4x4 m;
JPH_MassProperties_DecomposePrincipalMomentsOfInertia(&properties, &m, &d);
vec3_fromJolt(diagonal, &d);
quat_fromMat4(rotation, &m.m11);
}

void lovrShapeGetCenterOfMass(Shape* shape, float center[3]) {
Expand Down

0 comments on commit 010ffee

Please sign in to comment.