diff --git a/src/api/l_graphics_pass.c b/src/api/l_graphics_pass.c index 3544efc6..9c53a07f 100644 --- a/src/api/l_graphics_pass.c +++ b/src/api/l_graphics_pass.c @@ -291,8 +291,7 @@ static int l_lovrPassSetViewPose(lua_State* L) { float position[4], orientation[4], matrix[16]; index = luax_readvec3(L, index, position, "vec3, number, or mat4"); index = luax_readquat(L, index, orientation, NULL); - mat4_fromQuat(matrix, orientation); - memcpy(matrix + 12, position, 3 * sizeof(float)); + mat4_fromPose(matrix, position, orientation); mat4_invert(matrix); lovrPassSetViewMatrix(pass, view, matrix); } diff --git a/src/modules/headset/headset_openxr.c b/src/modules/headset/headset_openxr.c index 42b3f495..4f2dcad5 100644 --- a/src/modules/headset/headset_openxr.c +++ b/src/modules/headset/headset_openxr.c @@ -2078,8 +2078,7 @@ static ModelData* openxr_newModelDataFB(XrHandTrackerEXT tracker, bool animated) // Inverse bind matrix XrPosef* pose = &mesh.jointBindPoses[i]; float* inverseBindMatrix = inverseBindMatrices + 16 * i; - mat4_fromQuat(inverseBindMatrix, &pose->orientation.x); - memcpy(inverseBindMatrix + 12, &pose->position.x, 3 * sizeof(float)); + mat4_fromPose(inverseBindMatrix, &pose->position.x, &pose->orientation.x); mat4_invert(inverseBindMatrix); // Add child bones by looking for any bones that have a parent of the current bone.