diff --git a/Cargo.toml b/Cargo.toml index 0b64a82ed3..7088676664 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -605,6 +605,10 @@ bevy_state = { path = "crates/bevy_state", version = "0.17.0-dev", default-featu bevy_asset = { path = "crates/bevy_asset", version = "0.17.0-dev", default-features = false } bevy_reflect = { path = "crates/bevy_reflect", version = "0.17.0-dev", default-features = false } bevy_image = { path = "crates/bevy_image", version = "0.17.0-dev", default-features = false } +# Opt into the new default glTF coordinate conversion that will be the default in 0.18.0 +bevy_gltf = { path = "crates/bevy_gltf", version = "0.17.0-dev", default-features = false, features = [ + "gltf_convert_coordinates_default", +] } bevy_gizmos = { path = "crates/bevy_gizmos", version = "0.17.0-dev", default-features = false } # Needed to poll Task examples futures-lite = "2.0.1" diff --git a/examples/3d/anisotropy.rs b/examples/3d/anisotropy.rs index edb0e92539..9db1316349 100644 --- a/examples/3d/anisotropy.rs +++ b/examples/3d/anisotropy.rs @@ -11,7 +11,7 @@ use bevy::{ }; /// The initial position of the camera. -const CAMERA_INITIAL_POSITION: Vec3 = vec3(-0.4, 0.0, 0.0); +const CAMERA_INITIAL_POSITION: Vec3 = vec3(0.4, 0.0, 0.0); /// The current settings of the app, as chosen by the user. #[derive(Resource)] @@ -107,7 +107,7 @@ fn setup(mut commands: Commands, asset_server: Res, app_status: Res commands.spawn(( SceneRoot(asset_server.load("models/AnisotropyBarnLamp/AnisotropyBarnLamp.gltf#Scene0")), - Transform::from_xyz(0.0, 0.07, -0.13), + Transform::from_xyz(0.0, 0.07, 0.13), Scene::BarnLamp, )); diff --git a/examples/3d/anti_aliasing.rs b/examples/3d/anti_aliasing.rs index fd93625c0e..b153a3d0db 100644 --- a/examples/3d/anti_aliasing.rs +++ b/examples/3d/anti_aliasing.rs @@ -279,9 +279,13 @@ fn setup( } // Flight Helmet - commands.spawn(SceneRoot(asset_server.load( - GltfAssetLabel::Scene(0).from_asset("models/FlightHelmet/FlightHelmet.gltf"), - ))); + commands.spawn(( + SceneRoot( + asset_server + .load(GltfAssetLabel::Scene(0).from_asset("models/FlightHelmet/FlightHelmet.gltf")), + ), + Transform::default().looking_to(Vec3::Z, Vec3::Y), + )); // Light commands.spawn(( diff --git a/examples/3d/atmosphere.rs b/examples/3d/atmosphere.rs index edc6d04dab..acda245244 100644 --- a/examples/3d/atmosphere.rs +++ b/examples/3d/atmosphere.rs @@ -110,7 +110,7 @@ fn setup_terrain_scene( ), Transform::from_xyz(-1.0, 0.0, -0.5) .with_scale(Vec3::splat(0.5)) - .with_rotation(Quat::from_rotation_y(PI / 2.0)), + .with_rotation(Quat::from_rotation_y(-PI / 2.0)), )); } diff --git a/examples/3d/atmospheric_fog.rs b/examples/3d/atmospheric_fog.rs index e24736cdd1..fe45bd2efb 100644 --- a/examples/3d/atmospheric_fog.rs +++ b/examples/3d/atmospheric_fog.rs @@ -66,9 +66,12 @@ fn setup_terrain_scene( )); // Terrain - commands.spawn(SceneRoot(asset_server.load( - GltfAssetLabel::Scene(0).from_asset("models/terrain/Mountains.gltf"), - ))); + commands.spawn(( + SceneRoot( + asset_server.load(GltfAssetLabel::Scene(0).from_asset("models/terrain/Mountains.gltf")), + ), + Transform::default().looking_to(Vec3::Z, Vec3::Y), + )); // Sky commands.spawn(( diff --git a/examples/3d/color_grading.rs b/examples/3d/color_grading.rs index 7a9971b5c2..3b55a7ad7d 100644 --- a/examples/3d/color_grading.rs +++ b/examples/3d/color_grading.rs @@ -356,9 +356,12 @@ fn add_camera(commands: &mut Commands, asset_server: &AssetServer, color_grading fn add_basic_scene(commands: &mut Commands, asset_server: &AssetServer) { // Spawn the main scene. - commands.spawn(SceneRoot(asset_server.load( - GltfAssetLabel::Scene(0).from_asset("models/TonemappingTest/TonemappingTest.gltf"), - ))); + commands.spawn(( + SceneRoot(asset_server.load( + GltfAssetLabel::Scene(0).from_asset("models/TonemappingTest/TonemappingTest.gltf"), + )), + Transform::default().looking_to(Vec3::Z, Vec3::Y), + )); // Spawn the flight helmet. commands.spawn(( @@ -366,7 +369,7 @@ fn add_basic_scene(commands: &mut Commands, asset_server: &AssetServer) { asset_server .load(GltfAssetLabel::Scene(0).from_asset("models/FlightHelmet/FlightHelmet.gltf")), ), - Transform::from_xyz(0.5, 0.0, -0.5).with_rotation(Quat::from_rotation_y(-0.15 * PI)), + Transform::from_xyz(0.5, 0.0, -0.5).with_rotation(Quat::from_rotation_y(-0.15 * PI + PI)), )); // Spawn the light. diff --git a/examples/3d/deferred_rendering.rs b/examples/3d/deferred_rendering.rs index 6f51cff8c2..f27509cd44 100644 --- a/examples/3d/deferred_rendering.rs +++ b/examples/3d/deferred_rendering.rs @@ -75,10 +75,13 @@ fn setup( let helmet_scene = asset_server .load(GltfAssetLabel::Scene(0).from_asset("models/FlightHelmet/FlightHelmet.gltf")); - commands.spawn(SceneRoot(helmet_scene.clone())); + commands.spawn(( + SceneRoot(helmet_scene.clone()), + Transform::default().looking_to(Vec3::Z, Vec3::Y), + )); commands.spawn(( SceneRoot(helmet_scene), - Transform::from_xyz(-4.0, 0.0, -3.0), + Transform::from_xyz(-4.0, 0.0, -3.0).looking_to(Vec3::Z, Vec3::Y), )); let mut forward_mat: StandardMaterial = Color::srgb(0.1, 0.2, 0.1).into(); diff --git a/examples/3d/depth_of_field.rs b/examples/3d/depth_of_field.rs index 7658fdea07..1d9629383a 100644 --- a/examples/3d/depth_of_field.rs +++ b/examples/3d/depth_of_field.rs @@ -84,9 +84,15 @@ fn setup(mut commands: Commands, asset_server: Res, app_settings: R } // Spawn the scene. - commands.spawn(SceneRoot(asset_server.load( - GltfAssetLabel::Scene(0).from_asset("models/DepthOfFieldExample/DepthOfFieldExample.glb"), - ))); + commands.spawn(( + SceneRoot( + asset_server.load( + GltfAssetLabel::Scene(0) + .from_asset("models/DepthOfFieldExample/DepthOfFieldExample.glb"), + ), + ), + Transform::default().looking_to(Vec3::Z, Vec3::Y), + )); // Spawn the help text. commands.spawn(( diff --git a/examples/3d/edit_material_on_gltf.rs b/examples/3d/edit_material_on_gltf.rs index 97c3c48296..a4733418a2 100644 --- a/examples/3d/edit_material_on_gltf.rs +++ b/examples/3d/edit_material_on_gltf.rs @@ -41,17 +41,20 @@ fn setup_scene(mut commands: Commands, asset_server: Res) { let flight_helmet = asset_server .load(GltfAssetLabel::Scene(0).from_asset("models/FlightHelmet/FlightHelmet.gltf")); // This model will keep its original materials - commands.spawn(SceneRoot(flight_helmet.clone())); + commands.spawn(( + SceneRoot(flight_helmet.clone()), + Transform::default().looking_to(Vec3::Z, Dir3::Y), + )); // This model will be tinted red commands.spawn(( SceneRoot(flight_helmet.clone()), - Transform::from_xyz(-1.25, 0., 0.), + Transform::from_xyz(-1.25, 0., 0.).looking_to(Vec3::Z, Dir3::Y), ColorOverride(palettes::tailwind::RED_300.into()), )); // This model will be tinted green commands.spawn(( SceneRoot(flight_helmet), - Transform::from_xyz(1.25, 0., 0.), + Transform::from_xyz(1.25, 0., 0.).looking_to(Vec3::Z, Dir3::Y), ColorOverride(palettes::tailwind::GREEN_300.into()), )); } diff --git a/examples/3d/irradiance_volumes.rs b/examples/3d/irradiance_volumes.rs index 80373512db..c58467c765 100644 --- a/examples/3d/irradiance_volumes.rs +++ b/examples/3d/irradiance_volumes.rs @@ -57,8 +57,8 @@ static CLICK_TO_MOVE_HELP_TEXT: &str = "Left click: Move the object"; static GIZMO_COLOR: Color = Color::Srgba(YELLOW); static VOXEL_FROM_WORLD: Mat4 = Mat4::from_cols_array_2d(&[ - [-42.317566, 0.0, 0.0, 0.0], - [0.0, 0.0, 44.601563, 0.0], + [42.317566, 0.0, 0.0, 0.0], + [0.0, 0.0, -44.601563, 0.0], [0.0, 16.73776, 0.0, 0.0], [0.0, 6.544792, 0.0, 1.0], ]); diff --git a/examples/3d/light_textures.rs b/examples/3d/light_textures.rs index 743f3b152e..87fffa1455 100644 --- a/examples/3d/light_textures.rs +++ b/examples/3d/light_textures.rs @@ -22,8 +22,8 @@ use widgets::{ #[path = "../helpers/widgets.rs"] mod widgets; -/// The speed at which the cube rotates, in radians per frame. -const CUBE_ROTATION_SPEED: f32 = 0.02; +/// The speed at which the cube rotates, in radians per second. +const CUBE_ROTATION_SPEED: f32 = FRAC_PI_2; /// The speed at which the selection can be moved, in spherical coordinate /// radians per mouse unit. @@ -381,9 +381,9 @@ fn draw_gizmos(mut gizmos: Gizmos, spotlight: Query<(&GlobalTransform, &SpotLigh } /// Rotates the cube a bit every frame. -fn rotate_cube(mut meshes: Query<&mut Transform, With>) { +fn rotate_cube(mut meshes: Query<&mut Transform, With>, time: Res