Skip to content

Commit 9edf538

Browse files
authored
Fix glTF light orientation (#20122)
# Objective - Extracted from #20099 - Turns out glTF also uses its viewport coordinate system for lights, so let's account for that ## Solution - Use the same branch for lights as for cameras when importing glTFs ## Testing - Ran a dedicated Blender test scene to verify that this is the correct behavior.
1 parent 33bed5d commit 9edf538

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

crates/bevy_gltf/src/convert_coordinates.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pub(crate) trait ConvertCameraCoordinates {
2424
/// - up: Y
2525
/// - right: X
2626
///
27+
/// The same convention is used for lights.
2728
/// See <https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#view-matrix>
2829
fn convert_camera_coordinates(self) -> Self;
2930
}

crates/bevy_gltf/src/loader/gltf_ext/scene.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub(crate) fn node_transform(node: &Node, convert_coordinates: bool) -> Transfor
4545
},
4646
};
4747
if convert_coordinates {
48-
if node.camera().is_some() {
48+
if node.camera().is_some() || node.light().is_some() {
4949
transform.convert_camera_coordinates()
5050
} else {
5151
transform.convert_coordinates()

0 commit comments

Comments
 (0)