Skip to content

Commit

Permalink
Assign the correct bone rest transform to nodes with matrix in GLTF
Browse files Browse the repository at this point in the history
  • Loading branch information
fire committed Oct 7, 2024
1 parent db66bd3 commit 662ace7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/gltf/gltf_document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,10 @@ Error GLTFDocument::_parse_nodes(Ref<GLTFState> p_state) {
if (n.has("skin")) {
node->skin = n["skin"];
}
Transform3D godot_rest_transform;
if (n.has("matrix")) {
node->transform = _arr_to_xform(n["matrix"]);
godot_rest_transform = node->transform;
} else {
if (n.has("translation")) {
node->set_position(_arr_to_vec3(n["translation"]));
Expand All @@ -613,12 +615,10 @@ Error GLTFDocument::_parse_nodes(Ref<GLTFState> p_state) {
if (n.has("scale")) {
node->set_scale(_arr_to_vec3(n["scale"]));
}

Transform3D godot_rest_transform;
godot_rest_transform.basis.set_quaternion_scale(node->transform.basis.get_rotation_quaternion(), node->transform.basis.get_scale());
godot_rest_transform.origin = node->transform.origin;
node->set_additional_data("GODOT_rest_transform", godot_rest_transform);
}
node->set_additional_data("GODOT_rest_transform", godot_rest_transform);

if (n.has("extensions")) {
Dictionary extensions = n["extensions"];
Expand Down

0 comments on commit 662ace7

Please sign in to comment.