Skip to content

Commit

Permalink
optimisation of the "bone socket" tutorial (raysan5#3864)
Browse files Browse the repository at this point in the history
Less matrix operations doing.
  • Loading branch information
ipzaur authored Mar 10, 2024
1 parent f072497 commit 1fad827
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions examples/models/models_bone_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,8 @@ int main(void)
Matrix matrixTransform = QuaternionToMatrix(rotate);
// Translate socket to its position in the current animation
matrixTransform = MatrixMultiply(matrixTransform, MatrixTranslate(transform->translation.x, transform->translation.y, transform->translation.z));
// Rotate socket by character angle
matrixTransform = MatrixMultiply(matrixTransform, QuaternionToMatrix(characterRotate));
// Translate socket to character position
matrixTransform = MatrixMultiply(matrixTransform, MatrixTranslate(position.x, position.y + 0.0f, position.z));
// Transform the socket using the transform of the character (angle and translate)
matrixTransform = MatrixMultiply(matrixTransform, characterModel.transform);

// Draw mesh at socket position with socket angle rotation
DrawMesh(equipModel[i].meshes[0], equipModel[i].materials[1], matrixTransform);
Expand Down

0 comments on commit 1fad827

Please sign in to comment.