diff options
| author | iP <[email protected]> | 2024-03-11 00:49:04 +0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-03-10 21:49:04 +0100 |
| commit | 1fad8277a37b366841eff1497ca07a7042d4a014 (patch) | |
| tree | af36c077bf91d46bd24e3122f99e4646392c1b88 /examples/models | |
| parent | f072497551d9f03b5fbded289f8af021c103a8c0 (diff) | |
| download | raylib-1fad8277a37b366841eff1497ca07a7042d4a014.tar.gz raylib-1fad8277a37b366841eff1497ca07a7042d4a014.zip | |
optimisation of the "bone socket" tutorial (#3864)
Less matrix operations doing.
Diffstat (limited to 'examples/models')
| -rw-r--r-- | examples/models/models_bone_socket.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/examples/models/models_bone_socket.c b/examples/models/models_bone_socket.c index 8f62f70f..66f952e8 100644 --- a/examples/models/models_bone_socket.c +++ b/examples/models/models_bone_socket.c @@ -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); |
