Skip to content

Commit 655ee4b

Browse files
robtfmmockersf
andauthored
Gltf handle missing bindposes (#18419)
# Objective correctly load gltfs without explicit bindposes ## Solution use identity matrices if bindposes are not found. note: currently does nothing, as gltfs without explicit bindposes fail to load, see <gltf-rs/gltf#449> --------- Co-authored-by: François Mockers <francois.mockers@vleue.com>
1 parent 28907ae commit 655ee4b

File tree

1 file changed

+4
-3
lines changed
  • crates/bevy_gltf/src/loader

1 file changed

+4
-3
lines changed

crates/bevy_gltf/src/loader/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -740,9 +740,10 @@ async fn load_gltf<'a, 'b, 'c>(
740740
let reader = gltf_skin.reader(|buffer| Some(&buffer_data[buffer.index()]));
741741
let local_to_bone_bind_matrices: Vec<Mat4> = reader
742742
.read_inverse_bind_matrices()
743-
.unwrap()
744-
.map(|mat| Mat4::from_cols_array_2d(&mat))
745-
.collect();
743+
.map(|mats| mats.map(|mat| Mat4::from_cols_array_2d(&mat)).collect())
744+
.unwrap_or_else(|| {
745+
core::iter::repeat_n(Mat4::IDENTITY, gltf_skin.joints().len()).collect()
746+
});
746747

747748
load_context
748749
.add_labeled_asset(

0 commit comments

Comments
 (0)