diff --git a/crates/benches_common_3d/Cargo.toml b/crates/benches_common_3d/Cargo.toml index 08b0e694..d2009104 100644 --- a/crates/benches_common_3d/Cargo.toml +++ b/crates/benches_common_3d/Cargo.toml @@ -4,6 +4,6 @@ version = "0.1.0" edition = "2021" [dependencies] -bevy = { git = "https://github.com/bevyengine/bevy.git", default-features = false } +bevy = { version = "0.13", default-features = false } bevy_xpbd_3d = { path = "../bevy_xpbd_3d", default-features = false } criterion = "0.5" diff --git a/crates/bevy_xpbd_2d/Cargo.toml b/crates/bevy_xpbd_2d/Cargo.toml index bed1989b..45cca07b 100644 --- a/crates/bevy_xpbd_2d/Cargo.toml +++ b/crates/bevy_xpbd_2d/Cargo.toml @@ -38,13 +38,13 @@ required-features = ["2d"] [dependencies] bevy_xpbd_derive = { path = "../bevy_xpbd_derive", version = "0.1" } -bevy = { git = "https://github.com/bevyengine/bevy.git", default-features = false } -bevy_math = { git = "https://github.com/bevyengine/bevy.git" } +bevy = { version = "0.13", default-features = false } +bevy_math = "0.13" parry2d = { git = "https://github.com/Jondolf/parry.git", branch = "update-nalgebra", optional = true } parry2d-f64 = { git = "https://github.com/Jondolf/parry.git", branch = "update-nalgebra", optional = true } -nalgebra = { git = "https://github.com/Jondolf/nalgebra.git", features = [ +nalgebra = { git = "https://github.com/dimforge/nalgebra", features = [ "convert-glam025", -], branch = "glam025" } +] } serde = { version = "1", features = ["derive"], optional = true } derive_more = "0.99" indexmap = "2.0.0" @@ -53,9 +53,7 @@ itertools = "0.12" [dev-dependencies] examples_common_2d = { path = "../examples_common_2d" } -bevy_math = { git = "https://github.com/bevyengine/bevy.git", features = [ - "approx", -] } +bevy_math = { version = "0.13", features = ["approx"] } approx = "0.5" insta = "1.0" diff --git a/crates/bevy_xpbd_2d/examples/chain_2d.rs b/crates/bevy_xpbd_2d/examples/chain_2d.rs index c714b5f7..4d418de9 100644 --- a/crates/bevy_xpbd_2d/examples/chain_2d.rs +++ b/crates/bevy_xpbd_2d/examples/chain_2d.rs @@ -54,7 +54,7 @@ fn setup( let current_particle = commands .spawn(( RigidBody::Dynamic, - MassPropertiesBundle::new_computed(&Collider::ball(particle_radius), 1.0), + MassPropertiesBundle::new_computed(&Collider::circle(particle_radius), 1.0), MaterialMesh2dBundle { mesh: particle_mesh.clone(), material: particle_material.clone(), diff --git a/crates/bevy_xpbd_2d/examples/collision_layers.rs b/crates/bevy_xpbd_2d/examples/collision_layers.rs index d118674b..5cd1c39a 100644 --- a/crates/bevy_xpbd_2d/examples/collision_layers.rs +++ b/crates/bevy_xpbd_2d/examples/collision_layers.rs @@ -39,7 +39,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(500.0, 25.0), + Collider::rectangle(500.0, 25.0), CollisionLayers::new([Layer::Blue], [Layer::Blue]), )); @@ -55,7 +55,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(500.0, 25.0), + Collider::rectangle(500.0, 25.0), CollisionLayers::new([Layer::Red], [Layer::Red]), )); @@ -78,7 +78,7 @@ fn setup( ..default() }, RigidBody::Dynamic, - Collider::ball(marble_radius as Scalar), + Collider::circle(marble_radius as Scalar), CollisionLayers::new([Layer::Blue], [Layer::Blue]), )); } @@ -100,7 +100,7 @@ fn setup( ..default() }, RigidBody::Dynamic, - Collider::ball(marble_radius as Scalar), + Collider::circle(marble_radius as Scalar), CollisionLayers::new([Layer::Red], [Layer::Red]), )); } diff --git a/crates/bevy_xpbd_2d/examples/distance_joint_2d.rs b/crates/bevy_xpbd_2d/examples/distance_joint_2d.rs index 8164b632..def0f496 100644 --- a/crates/bevy_xpbd_2d/examples/distance_joint_2d.rs +++ b/crates/bevy_xpbd_2d/examples/distance_joint_2d.rs @@ -39,7 +39,7 @@ fn setup(mut commands: Commands) { ..default() }, RigidBody::Dynamic, - MassPropertiesBundle::new_computed(&Collider::cuboid(50.0, 50.0), 1.0), + MassPropertiesBundle::new_computed(&Collider::rectangle(50.0, 50.0), 1.0), )) .id(); diff --git a/crates/bevy_xpbd_2d/examples/dynamic_character_2d/main.rs b/crates/bevy_xpbd_2d/examples/dynamic_character_2d/main.rs index 9009d46d..a1a3397c 100644 --- a/crates/bevy_xpbd_2d/examples/dynamic_character_2d/main.rs +++ b/crates/bevy_xpbd_2d/examples/dynamic_character_2d/main.rs @@ -76,7 +76,7 @@ fn setup( ..default() }, RigidBody::Dynamic, - Collider::cuboid(30.0, 30.0), + Collider::rectangle(30.0, 30.0), )); // Platforms @@ -91,7 +91,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(1100.0, 50.0), + Collider::rectangle(1100.0, 50.0), )); commands.spawn(( SpriteBundle { @@ -104,7 +104,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(300.0, 25.0), + Collider::rectangle(300.0, 25.0), )); commands.spawn(( SpriteBundle { @@ -117,7 +117,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(300.0, 25.0), + Collider::rectangle(300.0, 25.0), )); commands.spawn(( SpriteBundle { @@ -130,7 +130,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(150.0, 80.0), + Collider::rectangle(150.0, 80.0), )); commands.spawn(( SpriteBundle { @@ -143,7 +143,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(150.0, 80.0), + Collider::rectangle(150.0, 80.0), )); // Ramps diff --git a/crates/bevy_xpbd_2d/examples/fixed_joint_2d.rs b/crates/bevy_xpbd_2d/examples/fixed_joint_2d.rs index 33233595..cd85a0e3 100644 --- a/crates/bevy_xpbd_2d/examples/fixed_joint_2d.rs +++ b/crates/bevy_xpbd_2d/examples/fixed_joint_2d.rs @@ -40,7 +40,7 @@ fn setup(mut commands: Commands) { ..default() }, RigidBody::Dynamic, - MassPropertiesBundle::new_computed(&Collider::cuboid(50.0, 50.0), 1.0), + MassPropertiesBundle::new_computed(&Collider::rectangle(50.0, 50.0), 1.0), )) .id(); diff --git a/crates/bevy_xpbd_2d/examples/kinematic_character_2d/main.rs b/crates/bevy_xpbd_2d/examples/kinematic_character_2d/main.rs index 4822b810..29af3f51 100644 --- a/crates/bevy_xpbd_2d/examples/kinematic_character_2d/main.rs +++ b/crates/bevy_xpbd_2d/examples/kinematic_character_2d/main.rs @@ -69,7 +69,7 @@ fn setup( ..default() }, RigidBody::Dynamic, - Collider::cuboid(30.0, 30.0), + Collider::rectangle(30.0, 30.0), )); // Platforms @@ -84,7 +84,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(1100.0, 50.0), + Collider::rectangle(1100.0, 50.0), )); commands.spawn(( SpriteBundle { @@ -97,7 +97,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(300.0, 25.0), + Collider::rectangle(300.0, 25.0), )); commands.spawn(( SpriteBundle { @@ -110,7 +110,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(300.0, 25.0), + Collider::rectangle(300.0, 25.0), )); commands.spawn(( SpriteBundle { @@ -123,7 +123,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(150.0, 80.0), + Collider::rectangle(150.0, 80.0), )); commands.spawn(( SpriteBundle { @@ -136,7 +136,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(150.0, 80.0), + Collider::rectangle(150.0, 80.0), )); // Ramps diff --git a/crates/bevy_xpbd_2d/examples/many_shapes.rs b/crates/bevy_xpbd_2d/examples/many_shapes.rs index 3ed6fdd8..f931451f 100644 --- a/crates/bevy_xpbd_2d/examples/many_shapes.rs +++ b/crates/bevy_xpbd_2d/examples/many_shapes.rs @@ -40,7 +40,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(50.0, 50.0), + Collider::rectangle(50.0, 50.0), )); // Floor commands.spawn(( @@ -51,7 +51,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(50.0, 50.0), + Collider::rectangle(50.0, 50.0), )); // Left wall commands.spawn(( @@ -62,7 +62,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(50.0, 50.0), + Collider::rectangle(50.0, 50.0), )); // Right wall commands.spawn(( @@ -73,16 +73,16 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(50.0, 50.0), + Collider::rectangle(50.0, 50.0), )); - let ball = ( - Collider::ball(7.5), + let circle = ( + Collider::circle(7.5), meshes.add(shape::Circle::new(7.5)).into(), materials.add(Color::rgb(0.29, 0.33, 0.64)), ); - let cuboid = ( - Collider::cuboid(15.0, 15.0), + let rectangle = ( + Collider::rectangle(15.0, 15.0), meshes.add(shape::Box::new(15.0, 15.0, 15.0)).into(), materials.add(Color::rgb(0.47, 0.58, 0.8)), ); @@ -109,7 +109,7 @@ fn setup( meshes.add(shape::RegularPolygon::new(10.0, 3)).into(), materials.add(Color::rgb(0.77, 0.87, 0.97)), ); - let shapes = [ball, cuboid, capsule, triangle]; + let shapes = [circle, rectangle, capsule, triangle]; for x in -12_i32..12 { for y in -8_i32..8 { diff --git a/crates/bevy_xpbd_2d/examples/move_marbles.rs b/crates/bevy_xpbd_2d/examples/move_marbles.rs index 511d118f..372020c4 100644 --- a/crates/bevy_xpbd_2d/examples/move_marbles.rs +++ b/crates/bevy_xpbd_2d/examples/move_marbles.rs @@ -40,7 +40,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(50.0, 50.0), + Collider::rectangle(50.0, 50.0), )); // Floor commands.spawn(( @@ -51,7 +51,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(50.0, 50.0), + Collider::rectangle(50.0, 50.0), )); // Left wall commands.spawn(( @@ -62,7 +62,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(50.0, 50.0), + Collider::rectangle(50.0, 50.0), )); // Right wall commands.spawn(( @@ -73,7 +73,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(50.0, 50.0), + Collider::rectangle(50.0, 50.0), )); let marble_radius = 5.0; @@ -95,7 +95,7 @@ fn setup( ..default() }, RigidBody::Dynamic, - Collider::ball(marble_radius as Scalar), + Collider::circle(marble_radius as Scalar), Marble, )); } diff --git a/crates/bevy_xpbd_2d/examples/one_way_platform_2d.rs b/crates/bevy_xpbd_2d/examples/one_way_platform_2d.rs index ea828493..65ed55d1 100644 --- a/crates/bevy_xpbd_2d/examples/one_way_platform_2d.rs +++ b/crates/bevy_xpbd_2d/examples/one_way_platform_2d.rs @@ -66,7 +66,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(50.0, 50.0), + Collider::rectangle(50.0, 50.0), )); // Floor commands.spawn(( @@ -77,7 +77,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(50.0, 50.0), + Collider::rectangle(50.0, 50.0), )); // Left wall commands.spawn(( @@ -88,7 +88,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(50.0, 50.0), + Collider::rectangle(50.0, 50.0), )); // Right wall commands.spawn(( @@ -99,7 +99,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(50.0, 50.0), + Collider::rectangle(50.0, 50.0), )); // For one-way platforms @@ -119,7 +119,7 @@ fn setup( ..default() }, RigidBody::Static, - Collider::cuboid(50.0, 50.0), + Collider::rectangle(50.0, 50.0), OneWayPlatform::default(), )); } @@ -137,7 +137,7 @@ fn setup( RigidBody::Dynamic, LockedAxes::ROTATION_LOCKED, Restitution::ZERO.with_combine_rule(CoefficientCombine::Min), - Collider::cuboid(actor_size.x, actor_size.y), + Collider::rectangle(actor_size.x, actor_size.y), Actor, PassThroughOneWayPlatform::ByNormal, MovementSpeed(250.0), diff --git a/crates/bevy_xpbd_2d/examples/prismatic_joint_2d.rs b/crates/bevy_xpbd_2d/examples/prismatic_joint_2d.rs index 1ee03c72..51fc5348 100644 --- a/crates/bevy_xpbd_2d/examples/prismatic_joint_2d.rs +++ b/crates/bevy_xpbd_2d/examples/prismatic_joint_2d.rs @@ -40,7 +40,7 @@ fn setup(mut commands: Commands) { ..default() }, RigidBody::Dynamic, - MassPropertiesBundle::new_computed(&Collider::cuboid(50.0, 50.0), 1.0), + MassPropertiesBundle::new_computed(&Collider::rectangle(50.0, 50.0), 1.0), )) .id(); diff --git a/crates/bevy_xpbd_2d/examples/ray_caster.rs b/crates/bevy_xpbd_2d/examples/ray_caster.rs index 8f29980c..f47013c5 100644 --- a/crates/bevy_xpbd_2d/examples/ray_caster.rs +++ b/crates/bevy_xpbd_2d/examples/ray_caster.rs @@ -44,7 +44,7 @@ fn setup( ), ..default() }, - Collider::ball(radius as Scalar), + Collider::circle(radius as Scalar), )); } } diff --git a/crates/bevy_xpbd_2d/examples/revolute_joint_2d.rs b/crates/bevy_xpbd_2d/examples/revolute_joint_2d.rs index fc43ec9e..f01f6124 100644 --- a/crates/bevy_xpbd_2d/examples/revolute_joint_2d.rs +++ b/crates/bevy_xpbd_2d/examples/revolute_joint_2d.rs @@ -40,7 +40,7 @@ fn setup(mut commands: Commands) { ..default() }, RigidBody::Dynamic, - MassPropertiesBundle::new_computed(&Collider::cuboid(50.0, 50.0), 1.0), + MassPropertiesBundle::new_computed(&Collider::rectangle(50.0, 50.0), 1.0), )) .id(); diff --git a/crates/bevy_xpbd_2d/examples/sensor.rs b/crates/bevy_xpbd_2d/examples/sensor.rs index 77e16e48..c8fb8889 100644 --- a/crates/bevy_xpbd_2d/examples/sensor.rs +++ b/crates/bevy_xpbd_2d/examples/sensor.rs @@ -71,7 +71,7 @@ fn setup( PressurePlate, Sensor, RigidBody::Static, - Collider::cuboid(100.0, 100.0), + Collider::rectangle(100.0, 100.0), Name::new("Pressure Plate"), )); diff --git a/crates/bevy_xpbd_2d/snapshots/bevy_xpbd_2d__tests__body_with_velocity_moves.snap b/crates/bevy_xpbd_2d/snapshots/bevy_xpbd_2d__tests__body_with_velocity_moves.snap index 20fe9d38..2e3fb912 100644 --- a/crates/bevy_xpbd_2d/snapshots/bevy_xpbd_2d__tests__body_with_velocity_moves.snap +++ b/crates/bevy_xpbd_2d/snapshots/bevy_xpbd_2d__tests__body_with_velocity_moves.snap @@ -4,14 +4,14 @@ expression: transform --- Transform { translation: Vec3( - 8.35, + 8.333334, 0.0, 0.0, ), rotation: Quat( 0.0, 0.0, - 0.0, + -0.0, 1.0, ), scale: Vec3( diff --git a/crates/bevy_xpbd_3d/Cargo.toml b/crates/bevy_xpbd_3d/Cargo.toml index bf0b5da8..e784c393 100644 --- a/crates/bevy_xpbd_3d/Cargo.toml +++ b/crates/bevy_xpbd_3d/Cargo.toml @@ -40,13 +40,13 @@ required-features = ["3d"] [dependencies] bevy_xpbd_derive = { path = "../bevy_xpbd_derive", version = "0.1" } -bevy = { git = "https://github.com/bevyengine/bevy.git", default-features = false } -bevy_math = { git = "https://github.com/bevyengine/bevy.git" } +bevy = { version = "0.13", default-features = false } +bevy_math = "0.13" parry3d = { git = "https://github.com/Jondolf/parry.git", branch = "update-nalgebra", optional = true } parry3d-f64 = { git = "https://github.com/Jondolf/parry.git", branch = "update-nalgebra", optional = true } -nalgebra = { git = "https://github.com/Jondolf/nalgebra.git", features = [ +nalgebra = { git = "https://github.com/dimforge/nalgebra", features = [ "convert-glam025", -], branch = "glam025" } +] } serde = { version = "1", features = ["derive"], optional = true } derive_more = "0.99" indexmap = "2.0.0" @@ -56,9 +56,7 @@ itertools = "0.12" [dev-dependencies] examples_common_3d = { path = "../examples_common_3d" } benches_common_3d = { path = "../benches_common_3d" } -bevy_math = { git = "https://github.com/bevyengine/bevy.git", features = [ - "approx", -] } +bevy_math = { version = "0.13", features = ["approx"] } approx = "0.5" criterion = { version = "0.5", features = ["html_reports"] } insta = "1.0" diff --git a/crates/bevy_xpbd_3d/examples/chain_3d.rs b/crates/bevy_xpbd_3d/examples/chain_3d.rs index 226109fe..f5d8e3bd 100644 --- a/crates/bevy_xpbd_3d/examples/chain_3d.rs +++ b/crates/bevy_xpbd_3d/examples/chain_3d.rs @@ -58,7 +58,7 @@ fn setup( let current_particle = commands .spawn(( RigidBody::Dynamic, - MassPropertiesBundle::new_computed(&Collider::ball(particle_radius), 1.0), + MassPropertiesBundle::new_computed(&Collider::sphere(particle_radius), 1.0), PbrBundle { mesh: particle_mesh.clone(), material: particle_material.clone(), diff --git a/crates/bevy_xpbd_3d/snapshots/bevy_xpbd_3d__tests__body_with_velocity_moves.snap b/crates/bevy_xpbd_3d/snapshots/bevy_xpbd_3d__tests__body_with_velocity_moves.snap index 06a7fba5..594a8ed2 100644 --- a/crates/bevy_xpbd_3d/snapshots/bevy_xpbd_3d__tests__body_with_velocity_moves.snap +++ b/crates/bevy_xpbd_3d/snapshots/bevy_xpbd_3d__tests__body_with_velocity_moves.snap @@ -4,7 +4,7 @@ expression: transform --- Transform { translation: Vec3( - 8.35, + 8.333334, 0.0, 0.0, ), diff --git a/crates/bevy_xpbd_3d/snapshots/bevy_xpbd_3d__tests__cubes_simulation_is_deterministic_across_machines.snap b/crates/bevy_xpbd_3d/snapshots/bevy_xpbd_3d__tests__cubes_simulation_is_deterministic_across_machines.snap index b18b3cc4..71b08a86 100644 --- a/crates/bevy_xpbd_3d/snapshots/bevy_xpbd_3d__tests__cubes_simulation_is_deterministic_across_machines.snap +++ b/crates/bevy_xpbd_3d/snapshots/bevy_xpbd_3d__tests__cubes_simulation_is_deterministic_across_machines.snap @@ -9,15 +9,15 @@ expression: bodies ), Transform { translation: Vec3( - -4.4807878, - 0.4999642, - -5.0702024, + -4.412756, + 0.49997884, + -5.933289, ), rotation: Quat( - 5.919203e-6, - -0.031166485, - 5.4873126e-6, - 0.9995142, + 1.2488733e-5, + -0.11259509, + -1.6300339e-6, + 0.99364096, ), scale: Vec3( 1.0, @@ -32,15 +32,15 @@ expression: bodies ), Transform { translation: Vec3( - -4.3474236, - 0.49993557, - -2.50855, + -4.4563684, + 0.49993253, + -2.695925, ), rotation: Quat( - 6.5286185e-6, - -0.08461056, - 1.6404623e-5, - 0.9964141, + -1.6138076e-6, + -0.15329537, + 1.3447959e-7, + 0.9881804, ), scale: Vec3( 1.0, @@ -55,15 +55,15 @@ expression: bodies ), Transform { translation: Vec3( - -4.5072284, - 0.49997458, - 0.03189523, + -4.4991455, + 0.49992895, + 0.075348005, ), rotation: Quat( - 2.4051024e-5, - -0.12200431, - -1.5172379e-5, - 0.9925296, + 8.939916e-6, + -0.037362672, + 6.6497855e-6, + 0.9993018, ), scale: Vec3( 1.0, @@ -78,15 +78,15 @@ expression: bodies ), Transform { translation: Vec3( - -4.2309165, - 0.4999984, - 2.5960162, + -4.4214344, + 0.49994704, + 2.3598442, ), rotation: Quat( - 4.769231e-6, - -0.007409913, - -3.08192e-7, - 0.9999725, + 1.2393669e-5, + -0.118021056, + 6.7488477e-6, + 0.9930111, ), scale: Vec3( 1.0, @@ -101,15 +101,15 @@ expression: bodies ), Transform { translation: Vec3( - -2.1472611, - 0.49995223, - -5.391549, + -2.1447492, + 0.49994978, + -5.383051, ), rotation: Quat( - 1.7596918e-5, - -0.07670317, - 1.006525e-6, - 0.997054, + 3.4370358e-5, + 0.00452591, + -4.764018e-6, + 0.99998975, ), scale: Vec3( 1.0, @@ -124,15 +124,15 @@ expression: bodies ), Transform { translation: Vec3( - -1.9834747, - 0.4999263, - -2.5556188, + -2.0498493, + 0.49993813, + -2.4912555, ), rotation: Quat( - -1.3627027e-5, - -0.06580644, - -3.036079e-6, - 0.9978324, + 1.703845e-5, + -0.16674739, + 3.1878487e-6, + 0.98599964, ), scale: Vec3( 1.0, @@ -147,15 +147,15 @@ expression: bodies ), Transform { translation: Vec3( - -2.0469987, - 0.4999356, - -0.08027569, + -2.1343985, + 0.4999466, + 0.027199415, ), rotation: Quat( - 7.0147953e-6, - -0.14110518, - -5.3421345e-6, - 0.9899946, + 4.0052262e-7, + -0.13359948, + 5.263204e-7, + 0.9910354, ), scale: Vec3( 1.0, @@ -170,15 +170,15 @@ expression: bodies ), Transform { translation: Vec3( - -2.0875623, - 0.49998045, - 2.590608, + -2.2457347, + 0.4999428, + 2.425038, ), rotation: Quat( - 5.42608e-6, - -0.060081214, - 7.3076053e-6, - 0.9981935, + 3.3158667e-6, + -0.113720566, + -3.498383e-6, + 0.99351275, ), scale: Vec3( 1.0, @@ -193,15 +193,15 @@ expression: bodies ), Transform { translation: Vec3( - 0.5825565, - 0.49995923, - -5.012298, + 0.28429016, + 0.49995828, + -5.2972436, ), rotation: Quat( - 1.4275838e-5, - -0.049236283, - -5.425154e-7, - 0.99878716, + 1.0153456e-5, + -0.08345168, + -3.2578175e-6, + 0.9965118, ), scale: Vec3( 1.0, @@ -216,15 +216,15 @@ expression: bodies ), Transform { translation: Vec3( - 0.11111179, - 0.4999287, - -2.3605862, + 0.17937997, + 0.49993762, + -2.4965737, ), rotation: Quat( - 4.0672085e-6, - -0.10964029, - -1.8544767e-6, - 0.99397135, + 6.527514e-6, + -0.17080474, + -5.5886208e-6, + 0.9853049, ), scale: Vec3( 1.0, @@ -239,15 +239,15 @@ expression: bodies ), Transform { translation: Vec3( - 0.05103929, - 0.49992737, - 0.029843591, + 0.11769989, + 0.49994552, + 0.0904399, ), rotation: Quat( - 1.2113869e-5, - -0.113881804, - -6.3577017e-6, - 0.99349433, + -1.4797135e-6, + -0.09786853, + -7.075673e-7, + 0.9951994, ), scale: Vec3( 1.0, @@ -262,15 +262,15 @@ expression: bodies ), Transform { translation: Vec3( - 0.10278174, - 0.4999518, - 2.5198464, + 0.0013185797, + 0.49995637, + 2.3447027, ), rotation: Quat( - -3.6256315e-6, - -0.053498358, - 1.1060847e-6, - 0.99856794, + 4.9192317e-6, + -0.12199612, + 9.834248e-6, + 0.9925306, ), scale: Vec3( 1.0, @@ -285,15 +285,15 @@ expression: bodies ), Transform { translation: Vec3( - 2.6845727, - 0.49996784, - -4.979438, + 2.8134532, + 0.49995807, + -5.263498, ), rotation: Quat( - 1.5580039e-5, - -0.09921448, - 1.4274427e-6, - 0.99506605, + 1.3468893e-5, + -0.08567302, + 6.1439237e-6, + 0.9963233, ), scale: Vec3( 1.0, @@ -308,15 +308,15 @@ expression: bodies ), Transform { translation: Vec3( - 2.4915159, - 0.49994114, - -2.2683852, + 2.3635142, + 0.49994224, + -2.5070152, ), rotation: Quat( - 8.894002e-6, - -0.0818818, - 3.4626048e-6, - 0.99664205, + 9.810995e-6, + -0.09259103, + -9.575585e-6, + 0.99570423, ), scale: Vec3( 1.0, @@ -331,15 +331,15 @@ expression: bodies ), Transform { translation: Vec3( - 2.4428256, - 0.4999324, - -0.1420561, + 2.4880779, + 0.49993357, + -0.15428042, ), rotation: Quat( - 4.7116623e-6, - -0.13768701, - -4.716268e-6, - 0.9904758, + 1.7498725e-6, + -0.0809388, + 1.0168985e-6, + 0.99671906, ), scale: Vec3( 1.0, @@ -354,15 +354,15 @@ expression: bodies ), Transform { translation: Vec3( - 2.3738887, - 0.49995124, - 2.5092518, + 2.2925658, + 0.49992672, + 2.379551, ), rotation: Quat( - 1.513096e-6, - -0.06438891, - 5.2519617e-6, - 0.99792486, + 1.5822523e-5, + -0.19126101, + -4.21922e-6, + 0.9815392, ), scale: Vec3( 1.0, @@ -377,15 +377,15 @@ expression: bodies ), Transform { translation: Vec3( - -4.4697585, - 2.4999409, - -4.55316, + -4.485228, + 2.4999545, + -4.5349884, ), rotation: Quat( - -8.215216e-6, - 0.05045268, - 1.0296776e-5, - 0.9987264, + 9.503106e-6, + -0.0824187, + -4.1908725e-6, + 0.99659777, ), scale: Vec3( 1.0, @@ -400,15 +400,15 @@ expression: bodies ), Transform { translation: Vec3( - -4.4707317, - 2.4999194, - -2.3423815, + -4.1805987, + 2.499891, + -2.185662, ), rotation: Quat( - 1.1098311e-6, - 0.04471522, - 1.6562923e-5, - 0.9989998, + 1.4274107e-6, + 0.0030354005, + 5.56327e-6, + 0.9999954, ), scale: Vec3( 1.0, @@ -423,15 +423,15 @@ expression: bodies ), Transform { translation: Vec3( - -4.369269, - 2.4998946, - -0.29516077, + -4.765607, + 2.499879, + 0.12764001, ), rotation: Quat( - 1.4761015e-5, - 0.040254377, - 1.8072324e-5, - 0.99918944, + 1.5524312e-5, + 0.010079111, + -6.217295e-6, + 0.9999492, ), scale: Vec3( 1.0, @@ -446,15 +446,15 @@ expression: bodies ), Transform { translation: Vec3( - -3.9547882, - 2.4999206, - 1.9814508, + -4.5375905, + 2.4999628, + 2.4084332, ), rotation: Quat( - -9.48857e-6, - 0.09606907, - 1.6128632e-5, - 0.9953747, + 1.2267928e-5, + 0.03752504, + -1.9542489e-7, + 0.9992957, ), scale: Vec3( 1.0, @@ -469,15 +469,15 @@ expression: bodies ), Transform { translation: Vec3( - -2.0379083, - 2.4999313, - -5.277153, + -1.9963549, + 2.4999409, + -4.8419933, ), rotation: Quat( - 2.1637099e-5, - 0.02028586, - 2.355e-6, - 0.99979424, + 5.7315752e-5, + -0.0041233683, + -5.8139882e-8, + 0.9999915, ), scale: Vec3( 1.0, @@ -492,15 +492,15 @@ expression: bodies ), Transform { translation: Vec3( - -2.1187255, - 2.4998865, - -2.7552195, + -1.9898971, + 2.4999545, + -2.240143, ), rotation: Quat( - 5.664726e-6, - -0.09973139, - 5.853004e-6, - 0.99501437, + 1.186729e-5, + 0.009139982, + -3.9852152e-6, + 0.9999582, ), scale: Vec3( 1.0, @@ -515,15 +515,15 @@ expression: bodies ), Transform { translation: Vec3( - -2.061535, - 2.4999099, - -0.517931, + -2.1382337, + 2.4999456, + -0.04046893, ), rotation: Quat( - -9.218147e-6, - -0.049740985, - 1.095837e-6, - 0.99876213, + -4.6483665e-6, + -0.00073893444, + -3.4330824e-6, + 0.9999997, ), scale: Vec3( 1.0, @@ -538,15 +538,15 @@ expression: bodies ), Transform { translation: Vec3( - -1.7603164, - 2.49992, - 1.9127235, + -1.6241425, + 2.499912, + 2.0066845, ), rotation: Quat( - -5.368472e-6, - 0.07879978, - 1.2774009e-5, - 0.9968905, + 1.3614011e-5, + 0.020298816, + 1.072885e-5, + 0.99979395, ), scale: Vec3( 1.0, @@ -561,15 +561,15 @@ expression: bodies ), Transform { translation: Vec3( - 0.19066897, - 2.499931, - -4.502981, + 0.16465269, + 2.4999263, + -4.470149, ), rotation: Quat( - 1.3212072e-5, - -0.031905502, - -3.9279826e-6, - 0.9994909, + -6.277859e-6, + -0.017593998, + -5.2566525e-6, + 0.9998452, ), scale: Vec3( 1.0, @@ -584,15 +584,15 @@ expression: bodies ), Transform { translation: Vec3( - 0.036287405, - 2.4998963, - -2.5037875, + 0.067446426, + 2.4999304, + -2.2192078, ), rotation: Quat( - -3.976938e-6, - -0.03319507, - -4.5129705e-6, - 0.9994489, + 1.8954732e-5, + 0.01897101, + -1.8210008e-5, + 0.99982005, ), scale: Vec3( 1.0, @@ -607,15 +607,15 @@ expression: bodies ), Transform { translation: Vec3( - 0.12751138, - 2.4999087, - -0.48551258, + 0.27802688, + 2.499953, + -0.06706346, ), rotation: Quat( - -3.879243e-6, - -0.03709484, - -7.2516036e-6, - 0.99931175, + 2.3035918e-6, + 0.0035030332, + -6.922778e-6, + 0.99999386, ), scale: Vec3( 1.0, @@ -630,15 +630,15 @@ expression: bodies ), Transform { translation: Vec3( - 0.3553794, - 2.4999537, - 1.9194841, + 0.43624628, + 2.49993, + 1.9980785, ), rotation: Quat( - -2.160615e-5, - 0.039799284, - -3.2012356e-6, - 0.9992077, + 1.1533771e-5, + 0.032706574, + 5.4833986e-6, + 0.999465, ), scale: Vec3( 1.0, @@ -653,15 +653,15 @@ expression: bodies ), Transform { translation: Vec3( - 2.6208673, - 2.4999564, - -4.813465, + 2.4098425, + 2.4999187, + -4.9082546, ), rotation: Quat( - 2.1585889e-5, - -0.001537976, - 5.677163e-6, - 0.9999988, + 7.803006e-6, + 0.032124408, + -8.158382e-7, + 0.9994839, ), scale: Vec3( 1.0, @@ -676,15 +676,15 @@ expression: bodies ), Transform { translation: Vec3( - 2.4625473, - 2.4999237, - -2.6464999, + 2.4213076, + 2.4999201, + -2.8263128, ), rotation: Quat( - 1.8284503e-6, - 0.043318942, - 9.715542e-6, - 0.9990613, + 3.2441683e-6, + 0.01641528, + -3.5890946e-6, + 0.99986523, ), scale: Vec3( 1.0, @@ -699,15 +699,15 @@ expression: bodies ), Transform { translation: Vec3( - 2.6266854, - 2.4999433, - -0.5581324, + 2.7333102, + 2.4999228, + -0.44100663, ), rotation: Quat( - -9.760203e-7, - 0.069429845, - -6.13081e-6, - 0.99758685, + -1.2596856e-6, + 0.079656705, + -1.1857236e-5, + 0.99682236, ), scale: Vec3( 1.0, @@ -722,15 +722,15 @@ expression: bodies ), Transform { translation: Vec3( - 2.5552654, - 2.4999619, - 2.0551982, + 2.6008544, + 2.4999468, + 2.4192235, ), rotation: Quat( - 2.1208946e-6, - 0.07812232, - 1.2371114e-6, - 0.9969438, + 2.2856288e-5, + 0.034191635, + -1.5087057e-5, + 0.9994153, ), scale: Vec3( 1.0, @@ -745,15 +745,15 @@ expression: bodies ), Transform { translation: Vec3( - -4.644625, - 4.4999366, - -4.3894167, + -4.2971663, + 4.4999123, + -3.8432565, ), rotation: Quat( - -1.1530554e-5, - 0.007823356, - 4.840596e-6, - 0.9999694, + -5.0037324e-6, + 0.006852863, + 1.2346757e-6, + 0.9999765, ), scale: Vec3( 1.0, @@ -768,15 +768,15 @@ expression: bodies ), Transform { translation: Vec3( - -4.583277, - 4.4999003, - -1.9201411, + -4.335363, + 4.4998927, + -1.7451508, ), rotation: Quat( - -4.450855e-6, - -0.0024590846, - 1.2154317e-5, - 0.99999696, + -1.0524934e-5, + -0.026445836, + 4.139708e-6, + 0.99965024, ), scale: Vec3( 1.0, @@ -791,15 +791,15 @@ expression: bodies ), Transform { translation: Vec3( - -4.738789, - 4.499869, - 0.21405242, + -4.7714787, + 4.499877, + 0.35351264, ), rotation: Quat( - 1.3008276e-5, - -0.024393229, - 1.5219967e-5, - 0.99970245, + 9.6044e-6, + 0.03712531, + -9.287988e-6, + 0.9993106, ), scale: Vec3( 1.0, @@ -814,15 +814,15 @@ expression: bodies ), Transform { translation: Vec3( - -4.2843614, - 4.4998903, - 2.3007255, + -4.7970796, + 4.4998727, + 2.772003, ), rotation: Quat( - -9.0125595e-6, - 0.029122893, - 1.5401198e-5, - 0.99957585, + 1.42767785e-5, + 0.004501023, + -3.3988813e-6, + 0.99998987, ), scale: Vec3( 1.0, @@ -837,15 +837,15 @@ expression: bodies ), Transform { translation: Vec3( - -2.1906574, - 4.499905, - -4.651567, + -2.1417034, + 4.499789, + -4.267216, ), rotation: Quat( - 9.649585e-6, - 0.06446429, - 4.6140535e-6, - 0.99792004, + 6.6696986e-5, + 0.025581645, + 1.927695e-6, + 0.9996727, ), scale: Vec3( 1.0, @@ -860,15 +860,15 @@ expression: bodies ), Transform { translation: Vec3( - -2.1716764, - 4.499888, - -2.2644317, + -2.026439, + 4.4998703, + -2.0626712, ), rotation: Quat( - -5.85968e-6, - -0.01909944, - 2.246405e-6, - 0.9998176, + 7.409019e-6, + 0.010577596, + -9.2272785e-6, + 0.99994403, ), scale: Vec3( 1.0, @@ -883,15 +883,15 @@ expression: bodies ), Transform { translation: Vec3( - -2.1644466, - 4.4998975, - -0.0516705, + -2.1309397, + 4.4999185, + 0.07222076, ), rotation: Quat( - -4.525609e-6, - -0.036787543, - -1.341388e-6, - 0.9993231, + 1.1899338e-6, + -0.00022890558, + -7.676071e-6, + 1.0, ), scale: Vec3( 1.0, @@ -906,15 +906,15 @@ expression: bodies ), Transform { translation: Vec3( - -2.1420982, - 4.499899, - 2.3749986, + -2.0055707, + 4.4998903, + 2.5978162, ), rotation: Quat( - -1.0568553e-5, - 0.057968765, - -7.2532143e-6, - 0.9983184, + 9.862658e-6, + 0.03825622, + 6.371329e-6, + 0.99926794, ), scale: Vec3( 1.0, @@ -929,15 +929,15 @@ expression: bodies ), Transform { translation: Vec3( - 0.027286595, - 4.4999022, - -4.030241, + 0.20182578, + 4.4999266, + -4.6506033, ), rotation: Quat( - 7.855375e-6, - 0.05007891, - -2.7275566e-6, - 0.99874526, + -3.3825906e-6, + 0.04204805, + -4.324491e-6, + 0.9991156, ), scale: Vec3( 1.0, @@ -952,15 +952,15 @@ expression: bodies ), Transform { translation: Vec3( - 0.16100131, - 4.499894, - -2.0173612, + 0.06143783, + 4.4999104, + -2.1186182, ), rotation: Quat( - -7.237491e-6, - 0.049617805, - -7.417327e-6, - 0.99876827, + 9.198389e-6, + 0.057064958, + -1.6621138e-5, + 0.99837047, ), scale: Vec3( 1.0, @@ -975,15 +975,15 @@ expression: bodies ), Transform { translation: Vec3( - -0.14214908, - 4.499927, - 0.17946397, + 0.09008749, + 4.499909, + 0.4059078, ), rotation: Quat( - 5.762941e-6, - -0.02646706, - -8.33544e-6, - 0.9996497, + -1.3736032e-5, + -0.04082854, + 1.8841715e-6, + 0.9991662, ), scale: Vec3( 1.0, @@ -998,15 +998,15 @@ expression: bodies ), Transform { translation: Vec3( - 0.08785327, - 4.499927, - 2.202648, + 0.10141875, + 4.499917, + 2.4459357, ), rotation: Quat( - -1.7184855e-5, - -0.02303224, - -2.695742e-6, - 0.9997347, + 2.1650978e-5, + -0.02168258, + 5.229496e-6, + 0.9997649, ), scale: Vec3( 1.0, @@ -1021,15 +1021,15 @@ expression: bodies ), Transform { translation: Vec3( - 2.2194319, - 4.499929, - -4.364764, + 2.4117937, + 4.4998984, + -4.3657637, ), rotation: Quat( - 1.3077079e-5, - 0.050272804, - 6.521861e-6, - 0.99873555, + -4.2042775e-6, + 0.048985492, + -6.035323e-6, + 0.9987995, ), scale: Vec3( 1.0, @@ -1044,15 +1044,15 @@ expression: bodies ), Transform { translation: Vec3( - 2.354827, - 4.4999084, - -2.1154532, + 2.2275023, + 4.499888, + -1.8621465, ), rotation: Quat( - -4.810856e-6, - 0.0688649, - 8.144779e-6, - 0.997626, + 1.0838617e-5, + 0.03107816, + 2.556269e-6, + 0.99951696, ), scale: Vec3( 1.0, @@ -1067,15 +1067,15 @@ expression: bodies ), Transform { translation: Vec3( - 2.315777, - 4.499854, - -0.016154509, + 2.3308487, + 4.49984, + 0.22742787, ), rotation: Quat( - 2.151056e-5, - 0.10178773, - 4.372974e-6, - 0.9948062, + 5.771548e-6, + 0.029534405, + 2.5869722e-6, + 0.99956375, ), scale: Vec3( 1.0, @@ -1090,15 +1090,15 @@ expression: bodies ), Transform { translation: Vec3( - 2.3743804, - 4.499916, - 2.3118012, + 2.3696156, + 4.4998636, + 2.8025134, ), rotation: Quat( - 1.3395618e-6, - 0.062318534, - -3.4639218e-6, - 0.9980563, + 1.5080648e-5, + -0.07724971, + -2.596575e-5, + 0.9970118, ), scale: Vec3( 1.0, @@ -1113,15 +1113,15 @@ expression: bodies ), Transform { translation: Vec3( - -4.493811, - 6.4998965, - -4.447015, + -4.5051923, + 6.4998903, + -3.810133, ), rotation: Quat( - -1.5055795e-5, - -0.0060957177, - -2.796977e-7, - 0.9999814, + 4.203818e-6, + 0.00550233, + -4.8972784e-6, + 0.99998486, ), scale: Vec3( 1.0, @@ -1136,15 +1136,15 @@ expression: bodies ), Transform { translation: Vec3( - -4.4694858, - 6.4999056, - -1.998712, + -4.5689893, + 6.499893, + -1.5330108, ), rotation: Quat( - -3.106658e-6, - -0.06473437, - 1.1266143e-5, - 0.9979025, + -1.2279531e-5, + -0.07520555, + 7.7855987e-7, + 0.99716806, ), scale: Vec3( 1.0, @@ -1159,15 +1159,15 @@ expression: bodies ), Transform { translation: Vec3( - -4.8597393, - 6.4998713, - -0.017722556, + -4.7065063, + 6.4998336, + 0.5526104, ), rotation: Quat( - 2.0195534e-5, - -0.057954583, - 1.4051288e-5, - 0.9983192, + 1.4557541e-5, + -0.03367962, + -8.779749e-6, + 0.9994327, ), scale: Vec3( 1.0, @@ -1182,15 +1182,15 @@ expression: bodies ), Transform { translation: Vec3( - -4.261576, - 6.499889, - 2.068535, + -4.6731706, + 6.499872, + 2.622469, ), rotation: Quat( - -1.2457654e-5, - -0.05247627, - 1.411736e-5, - 0.9986222, + 1.1933248e-5, + -0.0046023433, + -7.500923e-6, + 0.9999894, ), scale: Vec3( 1.0, @@ -1205,15 +1205,15 @@ expression: bodies ), Transform { translation: Vec3( - -2.3444922, - 6.4998975, - -4.1417465, + -2.1444836, + 6.499803, + -4.349761, ), rotation: Quat( - 6.53566e-6, - -0.019902026, - 2.3184118e-6, - 0.99980193, + 6.1202765e-5, + 0.0016883515, + -1.1926737e-6, + 0.99999857, ), scale: Vec3( 1.0, @@ -1228,15 +1228,15 @@ expression: bodies ), Transform { translation: Vec3( - -2.3154151, - 6.4998865, - -1.7937529, + -2.1940129, + 6.4998727, + -2.1784127, ), rotation: Quat( - -3.5610071e-6, - -0.060439195, - -6.1837056e-7, - 0.99817187, + 1.1310669e-5, + -0.019140596, + -1.1338596e-5, + 0.9998168, ), scale: Vec3( 1.0, @@ -1251,15 +1251,15 @@ expression: bodies ), Transform { translation: Vec3( - -2.2358956, - 6.4999013, - 0.23073928, + -2.153471, + 6.499916, + -0.13986145, ), rotation: Quat( - -4.4524263e-6, - -0.060491487, - -4.5852094e-6, - 0.9981687, + 5.362298e-6, + -0.011965028, + -9.501719e-6, + 0.9999284, ), scale: Vec3( 1.0, @@ -1274,15 +1274,15 @@ expression: bodies ), Transform { translation: Vec3( - -2.1131287, - 6.499888, - 2.4091856, + -2.0463588, + 6.499861, + 2.3378937, ), rotation: Quat( - -3.9038136e-6, - 0.032792933, - -1.1557194e-6, - 0.9994622, + 4.03701e-6, + 0.013133474, + 5.30854e-6, + 0.99991375, ), scale: Vec3( 1.0, @@ -1297,15 +1297,15 @@ expression: bodies ), Transform { translation: Vec3( - -0.34797272, - 6.499908, - -3.9961116, + 0.45179436, + 6.499898, + -5.082483, ), rotation: Quat( - 8.2992765e-6, - -0.020290572, - -9.735487e-7, - 0.9997941, + -7.7595705e-6, + 0.23150676, + 2.7409362e-6, + 0.9728333, ), scale: Vec3( 1.0, @@ -1320,15 +1320,15 @@ expression: bodies ), Transform { translation: Vec3( - 0.158857, - 6.499889, - -1.9555687, + -0.04225794, + 6.4999123, + -2.307129, ), rotation: Quat( - 3.5592802e-6, - -0.012161026, - -9.217503e-6, - 0.99992603, + 1.1916372e-5, + 0.018675506, + -1.88421e-5, + 0.9998256, ), scale: Vec3( 1.0, @@ -1343,15 +1343,15 @@ expression: bodies ), Transform { translation: Vec3( - 0.008170868, - 6.4998903, - 0.082892604, + 0.08154735, + 6.4999113, + 0.37454426, ), rotation: Quat( - 5.6333156e-6, - -0.03465553, - -1.4869478e-5, - 0.9993993, + -1.4968491e-5, + -0.0477015, + 1.3139173e-6, + 0.9988616, ), scale: Vec3( 1.0, @@ -1366,15 +1366,15 @@ expression: bodies ), Transform { translation: Vec3( - 0.0049426695, - 6.4999166, - 2.202866, + 0.14312406, + 6.4999194, + 2.393739, ), rotation: Quat( - -5.8677647e-6, - -0.012977003, - -1.1856126e-6, - 0.9999158, + 1.992816e-5, + -0.045010325, + 3.2358441e-6, + 0.99898654, ), scale: Vec3( 1.0, @@ -1389,15 +1389,15 @@ expression: bodies ), Transform { translation: Vec3( - 1.6746054, - 6.499919, - -3.9071012, + 2.8398702, + 6.499892, + -4.350771, ), rotation: Quat( - 8.602483e-6, - -0.029680222, - 9.092781e-6, - 0.99955946, + 1.3100966e-6, + 0.06222463, + -1.1506304e-5, + 0.9980622, ), scale: Vec3( 1.0, @@ -1412,15 +1412,15 @@ expression: bodies ), Transform { translation: Vec3( - 2.2873921, - 6.4999075, - -1.7616359, + 2.064684, + 6.499893, + -2.0412836, ), rotation: Quat( - -2.6282398e-6, - 0.029490719, - 1.0565523e-5, - 0.99956506, + 1.0947143e-5, + 0.05536288, + 1.9659664e-7, + 0.9984663, ), scale: Vec3( 1.0, @@ -1435,15 +1435,15 @@ expression: bodies ), Transform { translation: Vec3( - 2.297765, - 6.499844, - 0.24726494, + 2.2600605, + 6.499847, + 0.10657572, ), rotation: Quat( - 2.6049574e-5, - 0.028383562, - 4.4167105e-6, - 0.99959713, + 1.1522514e-5, + 0.027097696, + 9.932345e-7, + 0.9996328, ), scale: Vec3( 1.0, @@ -1458,15 +1458,15 @@ expression: bodies ), Transform { translation: Vec3( - 2.2569964, - 6.4998794, - 2.321111, + 2.5827608, + 6.4998703, + 2.3985717, ), rotation: Quat( - 6.4520364e-8, - 0.024427187, - -1.6952694e-7, - 0.9997016, + 1.895812e-5, + 0.048459783, + -2.5742962e-5, + 0.99882513, ), scale: Vec3( 1.0, diff --git a/crates/examples_common_2d/Cargo.toml b/crates/examples_common_2d/Cargo.toml index a50a55dd..0d141823 100644 --- a/crates/examples_common_2d/Cargo.toml +++ b/crates/examples_common_2d/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -bevy = { git = "https://github.com/bevyengine/bevy.git", default-features = false, features = [ +bevy = { version = "0.13", default-features = false, features = [ "bevy_core_pipeline", "bevy_text", "bevy_ui", diff --git a/crates/examples_common_3d/Cargo.toml b/crates/examples_common_3d/Cargo.toml index e47651c5..b4f06e9c 100644 --- a/crates/examples_common_3d/Cargo.toml +++ b/crates/examples_common_3d/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -bevy = { git = "https://github.com/bevyengine/bevy.git", default-features = false, features = [ +bevy = { version = "0.13", default-features = false, features = [ "bevy_core_pipeline", "bevy_text", "bevy_ui", diff --git a/src/components/collider.rs b/src/components/collider/mod.rs similarity index 89% rename from src/components/collider.rs rename to src/components/collider/mod.rs index cea5d2a8..569e09ca 100644 --- a/src/components/collider.rs +++ b/src/components/collider/mod.rs @@ -1,3 +1,5 @@ +#![allow(clippy::unnecessary_cast)] + use std::fmt; use crate::{prelude::*, utils::make_isometry}; @@ -18,6 +20,26 @@ use parry::{ shape::{RoundShape, SharedShape, TypedShape}, }; +#[cfg(feature = "2d")] +mod primitives2d; +#[cfg(feature = "3d")] +mod primitives3d; + +#[cfg(feature = "2d")] +pub(crate) use primitives2d::EllipseWrapper; + +/// A trait for creating [`Collider`]s from other types. +pub trait IntoCollider { + /// Creates a [`Collider`] from `self`. + fn collider(&self) -> Collider; +} + +impl From for Collider { + fn from(value: C) -> Self { + value.collider() + } +} + /// Parameters controlling the VHACD convex decomposition algorithm. /// /// See for details. @@ -39,7 +61,8 @@ pub type TriMeshFlags = parry::shape::TriMeshFlags; /// # /// # fn setup(mut commands: Commands) { /// // Create a ball collider with a given radius -/// commands.spawn(Collider::ball(0.5)); +#[cfg_attr(feature = "2d", doc = "commands.spawn(Collider::circle(0.5));")] +#[cfg_attr(feature = "3d", doc = "commands.spawn(Collider::sphere(0.5));")] /// // Create a capsule collider with a given height and radius /// commands.spawn(Collider::capsule(2.0, 0.5)); /// # } @@ -59,12 +82,13 @@ pub type TriMeshFlags = parry::shape::TriMeshFlags; /// fn setup(mut commands: Commands) { /// commands.spawn(( /// RigidBody::Dynamic, -/// Collider::ball(0.5), +#[cfg_attr(feature = "2d", doc = " Collider::circle(0.5),")] +#[cfg_attr(feature = "3d", doc = " Collider::sphere(0.5),")] /// Transform::from_xyz(0.0, 2.0, 0.0), /// )); #[cfg_attr( feature = "2d", - doc = " commands.spawn((RigidBody::Static, Collider::cuboid(5.0, 0.5)));" + doc = " commands.spawn((RigidBody::Static, Collider::rectangle(5.0, 0.5)));" )] #[cfg_attr( feature = "3d", @@ -104,11 +128,26 @@ pub type TriMeshFlags = parry::shape::TriMeshFlags; /// fn setup(mut commands: Commands) { /// // Spawn a rigid body with one collider on the same entity and two as children /// commands -/// .spawn((RigidBody::Dynamic, Collider::ball(0.5))) +#[cfg_attr( + feature = "2d", + doc = " .spawn((RigidBody::Dynamic, Collider::circle(0.5)))" +)] +#[cfg_attr( + feature = "3d", + doc = " .spawn((RigidBody::Dynamic, Collider::sphere(0.5)))" +)] /// .with_children(|children| { /// // Spawn the child colliders positioned relative to the rigid body -/// children.spawn((Collider::ball(0.5), Transform::from_xyz(2.0, 0.0, 0.0))); -/// children.spawn((Collider::ball(0.5), Transform::from_xyz(-2.0, 0.0, 0.0))); +#[cfg_attr( + feature = "2d", + doc = " children.spawn((Collider::circle(0.5), Transform::from_xyz(2.0, 0.0, 0.0))); + children.spawn((Collider::circle(0.5), Transform::from_xyz(-2.0, 0.0, 0.0)));" +)] +#[cfg_attr( + feature = "3d", + doc = " children.spawn((Collider::sphere(0.5), Transform::from_xyz(2.0, 0.0, 0.0))); + children.spawn((Collider::sphere(0.5), Transform::from_xyz(-2.0, 0.0, 0.0)));" +)] /// }); /// } /// ``` @@ -171,7 +210,7 @@ impl Default for Collider { fn default() -> Self { #[cfg(feature = "2d")] { - Self::cuboid(0.5, 0.5) + Self::rectangle(0.5, 0.5) } #[cfg(feature = "3d")] { @@ -422,13 +461,50 @@ impl Collider { SharedShape::compound(shapes).into() } + /// Creates a collider with a circle shape defined by its radius. + #[cfg(feature = "2d")] + pub fn circle(radius: Scalar) -> Self { + SharedShape::ball(radius).into() + } + + /// Creates a collider with a sphere shape defined by its radius. + #[cfg(feature = "3d")] + pub fn sphere(radius: Scalar) -> Self { + SharedShape::ball(radius).into() + } + /// Creates a collider with a ball shape defined by its radius. + #[cfg_attr( + feature = "2d", + deprecated(since = "0.4.0", note = "please use `Collider::circle` instead") + )] + #[cfg_attr( + feature = "3d", + deprecated(since = "0.4.0", note = "please use `Collider::sphere` instead") + )] pub fn ball(radius: Scalar) -> Self { SharedShape::ball(radius).into() } - /// Creates a collider with a cuboid shape defined by its extents. + /// Creates a collider with an ellipse shape defined by a half-width and half-height. #[cfg(feature = "2d")] + pub fn ellipse(half_width: Scalar, half_height: Scalar) -> Self { + SharedShape::new(EllipseWrapper(Ellipse::new( + half_width as f32, + half_height as f32, + ))) + .into() + } + + /// Creates a collider with a rectangle shape defined by its extents. + #[cfg(feature = "2d")] + pub fn rectangle(x_length: Scalar, y_length: Scalar) -> Self { + SharedShape::cuboid(x_length * 0.5, y_length * 0.5).into() + } + + /// Creates a collider with a ball shape defined by its radius. + #[cfg(feature = "2d")] + #[deprecated(since = "0.4.0", note = "please use `Collider::rectangle` instead")] pub fn cuboid(x_length: Scalar, y_length: Scalar) -> Self { SharedShape::cuboid(x_length * 0.5, y_length * 0.5).into() } @@ -439,8 +515,18 @@ impl Collider { SharedShape::cuboid(x_length * 0.5, y_length * 0.5, z_length * 0.5).into() } - /// Creates a collider with a cuboid shape defined by its extents and rounded corners. + /// Creates a collider with a rectangle shape defined by its extents and rounded corners. + #[cfg(feature = "2d")] + pub fn round_rectangle(x_length: Scalar, y_length: Scalar, border_radius: Scalar) -> Self { + SharedShape::round_cuboid(x_length * 0.5, y_length * 0.5, border_radius).into() + } + + /// Creates a collider with a ball shape defined by its radius. #[cfg(feature = "2d")] + #[deprecated( + since = "0.4.0", + note = "please use `Collider::round_rectangle` instead" + )] pub fn round_cuboid(x_length: Scalar, y_length: Scalar, border_radius: Scalar) -> Self { SharedShape::round_cuboid(x_length * 0.5, y_length * 0.5, border_radius).into() } @@ -504,6 +590,12 @@ impl Collider { SharedShape::triangle(a.into(), b.into(), c.into()).into() } + /// Creates a collider with a regular polygon shape defined by the circumradius and the number of sides. + #[cfg(feature = "2d")] + pub fn regular_polygon(circumradius: f32, sides: usize) -> Self { + RegularPolygon::new(circumradius, sides).collider() + } + /// Creates a collider with a polyline shape defined by its vertices and optionally an index buffer. pub fn polyline(vertices: Vec, indices: Option>) -> Self { let vertices = vertices.into_iter().map(|v| v.into()).collect(); @@ -817,14 +909,28 @@ fn scale_shape( Some(Either::Left(b)) => Ok(SharedShape::new(b)), Some(Either::Right(b)) => Ok(SharedShape::new(b)), }, - TypedShape::Ball(b) => match b.scaled(&scale.into(), num_subdivisions) { - None => { - log::error!("Failed to apply scale {} to Ball shape.", scale); - Ok(SharedShape::ball(0.0)) + TypedShape::Ball(b) => { + #[cfg(feature = "2d")] + { + if scale.x == scale.y { + Ok(SharedShape::ball(b.radius * scale.x)) + } else { + // A 2D circle becomes an ellipse when scaled non-uniformly. + Ok(SharedShape::new(EllipseWrapper(Ellipse { + half_size: Vec2::splat(b.radius as f32) * scale.f32(), + }))) + } } - Some(Either::Left(b)) => Ok(SharedShape::new(b)), - Some(Either::Right(b)) => Ok(SharedShape::new(b)), - }, + #[cfg(feature = "3d")] + match b.scaled(&scale.into(), num_subdivisions) { + None => { + log::error!("Failed to apply scale {} to Ball shape.", scale); + Ok(SharedShape::ball(0.0)) + } + Some(Either::Left(b)) => Ok(SharedShape::new(b)), + Some(Either::Right(b)) => Ok(SharedShape::new(b)), + } + } TypedShape::Segment(s) => Ok(SharedShape::new(s.scaled(&scale.into()))), TypedShape::Triangle(t) => Ok(SharedShape::new(t.scaled(&scale.into()))), TypedShape::RoundTriangle(t) => Ok(SharedShape::new(RoundShape { @@ -957,7 +1063,17 @@ fn scale_shape( } Ok(SharedShape::compound(scaled)) } - _ => Err(parry::query::Unsupported), + TypedShape::Custom(_id) => { + #[cfg(feature = "2d")] + if _id == 1 { + if let Some(ellipse) = shape.as_shape::() { + return Ok(SharedShape::new(EllipseWrapper(Ellipse { + half_size: ellipse.half_size * scale.f32(), + }))); + } + } + Err(parry::query::Unsupported) + } } } @@ -1178,10 +1294,26 @@ pub enum ComputedCollider { /// // Spawn a rigid body with one collider on the same entity and two as children. /// // Each entity will have a ColliderParent component that has the same rigid body entity. /// commands -/// .spawn((RigidBody::Dynamic, Collider::ball(0.5))) +#[cfg_attr( + feature = "2d", + doc = " .spawn((RigidBody::Dynamic, Collider::circle(0.5)))" +)] +#[cfg_attr( + feature = "3d", + doc = " .spawn((RigidBody::Dynamic, Collider::sphere(0.5)))" +)] /// .with_children(|children| { -/// children.spawn((Collider::ball(0.5), Transform::from_xyz(2.0, 0.0, 0.0))); -/// children.spawn((Collider::ball(0.5), Transform::from_xyz(-2.0, 0.0, 0.0))); +/// // Spawn the child colliders positioned relative to the rigid body +#[cfg_attr( + feature = "2d", + doc = " children.spawn((Collider::circle(0.5), Transform::from_xyz(2.0, 0.0, 0.0))); + children.spawn((Collider::circle(0.5), Transform::from_xyz(-2.0, 0.0, 0.0)));" +)] +#[cfg_attr( + feature = "3d", + doc = " children.spawn((Collider::sphere(0.5), Transform::from_xyz(2.0, 0.0, 0.0))); + children.spawn((Collider::sphere(0.5), Transform::from_xyz(-2.0, 0.0, 0.0)));" +)] /// }); /// } /// ``` @@ -1272,7 +1404,14 @@ impl From for ColliderTransform { /// fn setup(mut commands: Commands) { /// // Spawn a static body with a sensor collider. /// // Other bodies will pass through, but it will still send collision events. -/// commands.spawn((RigidBody::Static, Collider::ball(0.5), Sensor)); +#[cfg_attr( + feature = "2d", + doc = " commands.spawn((RigidBody::Static, Collider::circle(0.5), Sensor));" +)] +#[cfg_attr( + feature = "3d", + doc = " commands.spawn((RigidBody::Static, Collider::sphere(0.5), Sensor));" +)] /// } /// ``` #[doc(alias = "Trigger")] diff --git a/src/components/collider/primitives2d.rs b/src/components/collider/primitives2d.rs new file mode 100644 index 00000000..631b6967 --- /dev/null +++ b/src/components/collider/primitives2d.rs @@ -0,0 +1,243 @@ +use crate::{AdjustPrecision, AsF32, Scalar, Vector}; + +use super::{Collider, IntoCollider}; +use bevy::prelude::Deref; +use bevy_math::{bounding::Bounded2d, prelude::*}; +use nalgebra::{Point2, Vector2}; +use parry::{ + mass_properties::MassProperties, + math::Isometry, + query::{ + details::local_ray_intersection_with_support_map_with_params, gjk::VoronoiSimplex, + point::local_point_projection_on_support_map, PointQuery, RayCast, + }, + shape::{FeatureId, Shape, SharedShape, SupportMap}, +}; + +impl IntoCollider for Circle { + fn collider(&self) -> Collider { + Collider::circle(self.radius.adjust_precision()) + } +} + +impl IntoCollider for Ellipse { + fn collider(&self) -> Collider { + Collider::from(SharedShape::new(EllipseWrapper(*self))) + } +} + +#[derive(Clone, Copy, Debug, Deref)] +pub(crate) struct EllipseWrapper(pub(crate) Ellipse); + +impl SupportMap for EllipseWrapper { + #[inline] + fn local_support_point(&self, direction: &Vector2) -> Point2 { + let [a, b] = self.half_size.adjust_precision().to_array(); + let denom = (direction.x.powi(2) * a * a + direction.y.powi(2) * b * b).sqrt(); + Point2::new(a * a * direction.x / denom, b * b * direction.y / denom) + } +} + +impl Shape for EllipseWrapper { + fn compute_local_aabb(&self) -> parry::bounding_volume::Aabb { + let aabb = self.aabb_2d(Vec2::ZERO, 0.0); + parry::bounding_volume::Aabb::new( + aabb.min.adjust_precision().into(), + aabb.max.adjust_precision().into(), + ) + } + + fn compute_aabb(&self, position: &Isometry) -> parry::bounding_volume::Aabb { + let aabb = self.aabb_2d( + Vector::from(position.translation).f32(), + position.rotation.angle() as f32, + ); + parry::bounding_volume::Aabb::new( + aabb.min.adjust_precision().into(), + aabb.max.adjust_precision().into(), + ) + } + + fn compute_local_bounding_sphere(&self) -> parry::bounding_volume::BoundingSphere { + let sphere = self.bounding_circle(Vec2::ZERO, 0.0); + parry::bounding_volume::BoundingSphere::new( + sphere.center.adjust_precision().into(), + sphere.radius().adjust_precision(), + ) + } + + fn compute_bounding_sphere( + &self, + position: &Isometry, + ) -> parry::bounding_volume::BoundingSphere { + let sphere = self.bounding_circle( + Vector::from(position.translation).f32(), + position.rotation.angle() as f32, + ); + parry::bounding_volume::BoundingSphere::new( + sphere.center.adjust_precision().into(), + sphere.radius().adjust_precision(), + ) + } + + fn clone_box(&self) -> Box { + Box::new(*self) + } + + fn mass_properties(&self, density: Scalar) -> MassProperties { + let volume = self.area().adjust_precision(); + let mass = volume * density; + let inertia = mass * self.half_size.length_squared().adjust_precision() / 4.0; + MassProperties::new(Point2::origin(), mass, inertia) + } + + fn is_convex(&self) -> bool { + true + } + + fn shape_type(&self) -> parry::shape::ShapeType { + parry::shape::ShapeType::Custom + } + + fn as_typed_shape(&self) -> parry::shape::TypedShape { + parry::shape::TypedShape::Custom(1) + } + + fn ccd_thickness(&self) -> Scalar { + self.half_size.max_element().adjust_precision() + } + + fn ccd_angular_thickness(&self) -> Scalar { + crate::math::PI + } + + fn as_support_map(&self) -> Option<&dyn SupportMap> { + Some(self as &dyn SupportMap) + } +} + +impl RayCast for EllipseWrapper { + fn cast_local_ray_and_get_normal( + &self, + ray: &parry::query::Ray, + max_toi: Scalar, + solid: bool, + ) -> Option { + local_ray_intersection_with_support_map_with_params( + self, + &mut VoronoiSimplex::new(), + ray, + max_toi, + solid, + ) + } +} + +impl PointQuery for EllipseWrapper { + fn project_local_point( + &self, + pt: &parry::math::Point, + solid: bool, + ) -> parry::query::PointProjection { + local_point_projection_on_support_map(self, &mut VoronoiSimplex::new(), pt, solid) + } + + fn project_local_point_and_get_feature( + &self, + pt: &parry::math::Point, + ) -> (parry::query::PointProjection, parry::shape::FeatureId) { + (self.project_local_point(pt, false), FeatureId::Unknown) + } +} + +impl IntoCollider for Plane2d { + fn collider(&self) -> Collider { + let vec = self.normal.perp().adjust_precision() * Scalar::MAX / 2.0; + Collider::segment(-vec, vec) + } +} + +impl IntoCollider for Line2d { + fn collider(&self) -> Collider { + let vec = self.direction.adjust_precision() * Scalar::MAX / 2.0; + Collider::segment(-vec, vec) + } +} + +impl IntoCollider for Segment2d { + fn collider(&self) -> Collider { + let (point1, point2) = (self.point1(), self.point2()); + Collider::segment(point1.adjust_precision(), point2.adjust_precision()) + } +} + +impl IntoCollider for Polyline2d { + fn collider(&self) -> Collider { + let vertices = self.vertices.map(|v| v.adjust_precision()); + Collider::polyline(vertices.to_vec(), None) + } +} + +impl IntoCollider for BoxedPolyline2d { + fn collider(&self) -> Collider { + let vertices = self.vertices.iter().map(|v| v.adjust_precision()); + Collider::polyline(vertices.collect(), None) + } +} + +impl IntoCollider for Triangle2d { + fn collider(&self) -> Collider { + Collider::triangle( + self.vertices[0].adjust_precision(), + self.vertices[1].adjust_precision(), + self.vertices[2].adjust_precision(), + ) + } +} + +impl IntoCollider for Rectangle { + fn collider(&self) -> Collider { + Collider::from(SharedShape::cuboid( + self.half_size.x.adjust_precision(), + self.half_size.y.adjust_precision(), + )) + } +} + +impl IntoCollider for Polygon { + fn collider(&self) -> Collider { + let vertices = self.vertices.map(|v| v.adjust_precision()); + let indices = (0..N as u32 - 1).map(|i| [i, i + 1]).collect(); + Collider::convex_decomposition(vertices.to_vec(), indices) + } +} + +impl IntoCollider for BoxedPolygon { + fn collider(&self) -> Collider { + let vertices = self.vertices.iter().map(|v| v.adjust_precision()); + let indices = (0..self.vertices.len() as u32 - 1) + .map(|i| [i, i + 1]) + .collect(); + Collider::convex_decomposition(vertices.collect(), indices) + } +} + +impl IntoCollider for RegularPolygon { + fn collider(&self) -> Collider { + let vertices = self + .vertices(0.0) + .into_iter() + .map(|v| v.adjust_precision()) + .collect(); + Collider::convex_hull(vertices).unwrap() + } +} + +impl IntoCollider for Capsule2d { + fn collider(&self) -> Collider { + Collider::capsule( + 2.0 * self.half_length.adjust_precision(), + self.radius.adjust_precision(), + ) + } +} diff --git a/src/components/collider/primitives3d.rs b/src/components/collider/primitives3d.rs new file mode 100644 index 00000000..97416208 --- /dev/null +++ b/src/components/collider/primitives3d.rs @@ -0,0 +1,93 @@ +use bevy_math::primitives::{ + BoxedPolyline3d, Capsule3d, Cone, Cuboid, Cylinder, Line3d, Plane3d, Polyline3d, Segment3d, + Sphere, +}; +use parry::shape::SharedShape; + +use crate::{AdjustPrecision, Collider, IntoCollider, Quaternion, Scalar, Vector}; + +impl IntoCollider for Sphere { + fn collider(&self) -> Collider { + Collider::sphere(self.radius.adjust_precision()) + } +} + +impl IntoCollider for Plane3d { + fn collider(&self) -> Collider { + let half_size = Scalar::MAX / 2.0; + let rotation = Quaternion::from_rotation_arc(Vector::Y, self.normal.adjust_precision()); + let vertices = vec![ + rotation * Vector::new(half_size, 0.0, -half_size), + rotation * Vector::new(-half_size, 0.0, -half_size), + rotation * Vector::new(-half_size, 0.0, half_size), + rotation * Vector::new(half_size, 0.0, half_size), + ]; + + Collider::trimesh(vertices, vec![[0, 1, 2], [1, 2, 0]]) + } +} + +impl IntoCollider for Line3d { + fn collider(&self) -> Collider { + let vec = self.direction.adjust_precision() * Scalar::MAX / 2.0; + Collider::segment(-vec, vec) + } +} + +impl IntoCollider for Segment3d { + fn collider(&self) -> Collider { + let (point1, point2) = (self.point1(), self.point2()); + Collider::segment(point1.adjust_precision(), point2.adjust_precision()) + } +} + +impl IntoCollider for Polyline3d { + fn collider(&self) -> Collider { + let vertices = self.vertices.map(|v| v.adjust_precision()); + Collider::polyline(vertices.to_vec(), None) + } +} + +impl IntoCollider for BoxedPolyline3d { + fn collider(&self) -> Collider { + let vertices = self.vertices.iter().map(|v| v.adjust_precision()); + Collider::polyline(vertices.collect(), None) + } +} + +impl IntoCollider for Cuboid { + fn collider(&self) -> Collider { + let [hx, hy, hz] = self.half_size.adjust_precision().to_array(); + Collider::from(SharedShape::cuboid(hx, hy, hz)) + } +} + +impl IntoCollider for Cylinder { + fn collider(&self) -> Collider { + Collider::from(SharedShape::cylinder( + self.half_height.adjust_precision(), + self.radius.adjust_precision(), + )) + } +} + +impl IntoCollider for Capsule3d { + fn collider(&self) -> Collider { + Collider::capsule( + 2.0 * self.half_length.adjust_precision(), + self.radius.adjust_precision(), + ) + } +} + +impl IntoCollider for Cone { + fn collider(&self) -> Collider { + Collider::cone( + self.height.adjust_precision(), + self.radius.adjust_precision(), + ) + } +} + +// TODO: ConicalFrustum +// TODO: Torus diff --git a/src/components/layers.rs b/src/components/layers.rs index 39a2a290..f976b8e6 100644 --- a/src/components/layers.rs +++ b/src/components/layers.rs @@ -63,7 +63,8 @@ impl PhysicsLayer for &L { /// /// fn spawn(mut commands: Commands) { /// commands.spawn(( -/// Collider::ball(0.5), +#[cfg_attr(feature = "2d", doc = " Collider::circle(0.5),")] +#[cfg_attr(feature = "3d", doc = " Collider::sphere(0.5),")] /// // Player collides with enemies and the ground, but not with other players /// CollisionLayers::new([Layer::Player], [Layer::Enemy, Layer::Ground]) /// )); diff --git a/src/components/mass_properties.rs b/src/components/mass_properties.rs index 27187c73..2a85cb2c 100644 --- a/src/components/mass_properties.rs +++ b/src/components/mass_properties.rs @@ -210,7 +210,14 @@ impl CenterOfMass { /// fn setup(mut commands: Commands) { /// commands.spawn(( /// RigidBody::Dynamic, -/// MassPropertiesBundle::new_computed(&Collider::ball(0.5), 1.0) +#[cfg_attr( + feature = "2d", + doc = " MassPropertiesBundle::new_computed(&Collider::circle(0.5), 1.0)," +)] +#[cfg_attr( + feature = "3d", + doc = " MassPropertiesBundle::new_computed(&Collider::sphere(0.5), 1.0)," +)] /// )); /// } /// ``` @@ -260,7 +267,8 @@ impl MassPropertiesBundle { /// fn setup(mut commands: Commands) { /// commands.spawn(( /// RigidBody::Dynamic, -/// Collider::ball(0.5), +#[cfg_attr(feature = "2d", doc = " Collider::circle(0.5),")] +#[cfg_attr(feature = "3d", doc = " Collider::sphere(0.5),")] /// ColliderDensity(2.5), /// )); /// } @@ -304,7 +312,8 @@ impl Default for ColliderDensity { /// } /// /// fn setup(mut commands: Commands) { -/// commands.spawn(Collider::ball(0.5)); +#[cfg_attr(feature = "2d", doc = " commands.spawn(Collider::circle(0.5));")] +#[cfg_attr(feature = "3d", doc = " commands.spawn(Collider::sphere(0.5));")] /// } /// /// fn print_collider_masses(query: Query<&ColliderMassProperties>) { diff --git a/src/components/mod.rs b/src/components/mod.rs index 1581f011..fabf6dd1 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -135,7 +135,14 @@ use derive_more::From; #[cfg_attr(feature = "3d", doc = "# use bevy_xpbd_3d::prelude::*;")] /// # /// # fn setup(mut commands: Commands) { -/// commands.spawn((RigidBody::Dynamic, Collider::ball(0.5))); +#[cfg_attr( + feature = "2d", + doc = "commands.spawn((RigidBody::Dynamic, Collider::circle(0.5)));" +)] +#[cfg_attr( + feature = "3d", + doc = "commands.spawn((RigidBody::Dynamic, Collider::sphere(0.5)));" +)] /// # } /// ``` /// @@ -153,7 +160,8 @@ use derive_more::From; /// # fn setup(mut commands: Commands) { /// commands.spawn(( /// RigidBody::Dynamic, -/// Collider::ball(0.5), +#[cfg_attr(feature = "2d", doc = " Collider::circle(0.5),")] +#[cfg_attr(feature = "3d", doc = " Collider::sphere(0.5),")] /// ColliderDensity(2.5), /// )); /// # } @@ -172,7 +180,14 @@ use derive_more::From; /// // This is equivalent to the earlier approach, but no collider will be added /// commands.spawn(( /// RigidBody::Dynamic, -/// MassPropertiesBundle::new_computed(&Collider::ball(0.5), 2.5), +#[cfg_attr( + feature = "2d", + doc = " MassPropertiesBundle::new_computed(&Collider::circle(0.5), 2.5)," +)] +#[cfg_attr( + feature = "3d", + doc = " MassPropertiesBundle::new_computed(&Collider::sphere(0.5), 2.5)," +)] /// )); /// # } /// ``` @@ -190,7 +205,8 @@ use derive_more::From; /// // Create a rigid body with a mass of 5.0 and a collider with no mass /// commands.spawn(( /// RigidBody::Dynamic, -/// Collider::ball(0.5), +#[cfg_attr(feature = "2d", doc = " Collider::circle(0.5),")] +#[cfg_attr(feature = "3d", doc = " Collider::sphere(0.5),")] /// ColliderDensity(0.0), /// Mass(5.0), /// // ...the rest of the mass properties diff --git a/src/constraints/mod.rs b/src/constraints/mod.rs index c53e37f0..5180ab63 100644 --- a/src/constraints/mod.rs +++ b/src/constraints/mod.rs @@ -33,7 +33,7 @@ //! It should look similar to this: //! //! ``` -//! use bevy::{ecs::entity::{M, MapEntities}, prelude::*}; +//! use bevy::{ecs::entity::{EntityMapper, MapEntities}, prelude::*}; #![cfg_attr(feature = "2d", doc = "use bevy_xpbd_2d::prelude::*;")] #![cfg_attr(feature = "3d", doc = "use bevy_xpbd_3d::prelude::*;")] //! diff --git a/src/lib.rs b/src/lib.rs index e546b4cf..cdeffd06 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -97,7 +97,14 @@ #![cfg_attr(feature = "3d", doc = "use bevy_xpbd_3d::prelude::*;")] //! //! fn setup(mut commands: Commands) { -//! commands.spawn((RigidBody::Dynamic, Collider::ball(0.5))); +#![cfg_attr( + feature = "2d", + doc = " commands.spawn((RigidBody::Dynamic, Collider::circle(0.5)));" +)] +#![cfg_attr( + feature = "3d", + doc = " commands.spawn((RigidBody::Dynamic, Collider::sphere(0.5)));" +)] //! } //! ``` //! diff --git a/src/plugins/collision/broad_phase.rs b/src/plugins/collision/broad_phase.rs index f06db64c..46998e15 100644 --- a/src/plugins/collision/broad_phase.rs +++ b/src/plugins/collision/broad_phase.rs @@ -295,7 +295,7 @@ fn sweep_and_prune( /// Sorts a list iteratively using comparisons. In an ascending sort order, when a smaller value is encountered, it is moved lower in the list until it is larger than the item before it. /// /// This is relatively slow for large lists, but very efficient in cases where the list is already mostly sorted. -fn insertion_sort(items: &mut Vec, comparison: fn(&T, &T) -> bool) { +fn insertion_sort(items: &mut [T], comparison: fn(&T, &T) -> bool) { for i in 1..items.len() { let mut j = i; while j > 0 && comparison(&items[j - 1], &items[j]) { diff --git a/src/plugins/collision/contact_query.rs b/src/plugins/collision/contact_query.rs index 5050c2fc..a7a66d13 100644 --- a/src/plugins/collision/contact_query.rs +++ b/src/plugins/collision/contact_query.rs @@ -36,7 +36,7 @@ pub type UnsupportedShape = Unsupported; /// /// # #[cfg(all(feature = "3d", feature = "f32"))] /// # { -/// let collider1 = Collider::ball(0.5); +/// let collider1 = Collider::sphere(0.5); /// let collider2 = Collider::cuboid(1.0, 1.0, 1.0); /// /// // Compute a contact that should have a penetration depth of 0.5 @@ -132,7 +132,7 @@ pub fn contact( /// /// # #[cfg(all(feature = "3d", feature = "f32"))] /// # { -/// let collider1 = Collider::ball(0.5); +/// let collider1 = Collider::sphere(0.5); /// let collider2 = Collider::cuboid(1.0, 1.0, 1.0); /// /// // Compute contact manifolds a collision that should be penetrating @@ -167,7 +167,8 @@ pub fn contact_manifolds( // TODO: Reuse manifolds from previous frame to improve performance let mut manifolds: Vec> = vec![]; - let _ = parry::query::DefaultQueryDispatcher.contact_manifolds( + + let result = parry::query::DefaultQueryDispatcher.contact_manifolds( &isometry12, collider1.shape_scaled().0.as_ref(), collider2.shape_scaled().0.as_ref(), @@ -175,6 +176,42 @@ pub fn contact_manifolds( &mut manifolds, &mut None, ); + + // Fall back to support map contacts for unsupported (custom) shapes. + if result.is_err() { + if let (Some(shape1), Some(shape2)) = ( + collider1.shape_scaled().as_support_map(), + collider2.shape_scaled().as_support_map(), + ) { + if let Some(contact) = parry::query::contact::contact_support_map_support_map( + &isometry12, + shape1, + shape2, + prediction_distance, + ) { + let normal1 = Vector::from(contact.normal1); + let normal2 = Vector::from(contact.normal2); + + // Make sure normals are valid + if !normal1.is_normalized() || !normal2.is_normalized() { + return vec![]; + } + + return vec![ContactManifold { + normal1, + normal2, + contacts: vec![ContactData { + point1: contact.point1.into(), + point2: contact.point2.into(), + normal1, + normal2, + penetration: -contact.dist, + }], + }]; + } + } + } + manifolds .iter() .filter_map(|manifold| { @@ -248,7 +285,7 @@ pub enum ClosestPoints { /// /// # #[cfg(all(feature = "3d", feature = "f32"))] /// # { -/// let collider1 = Collider::ball(0.5); +/// let collider1 = Collider::sphere(0.5); /// let collider2 = Collider::cuboid(1.0, 1.0, 1.0); /// /// // The shapes are intersecting @@ -343,7 +380,7 @@ pub fn closest_points( /// /// # #[cfg(all(feature = "3d", feature = "f32"))] /// # { -/// let collider1 = Collider::ball(0.5); +/// let collider1 = Collider::sphere(0.5); /// let collider2 = Collider::cuboid(1.0, 1.0, 1.0); /// /// // The distance is 1.0 @@ -411,7 +448,7 @@ pub fn distance( /// /// # #[cfg(all(feature = "3d", feature = "f32"))] /// # { -/// let collider1 = Collider::ball(0.5); +/// let collider1 = Collider::sphere(0.5); /// let collider2 = Collider::cuboid(1.0, 1.0, 1.0); /// /// // These colliders should be intersecting @@ -504,7 +541,7 @@ pub struct TimeOfImpact { /// /// # #[cfg(all(feature = "3d", feature = "f32"))] /// # { -/// let collider1 = Collider::ball(0.5); +/// let collider1 = Collider::sphere(0.5); /// let collider2 = Collider::cuboid(1.0, 1.0, 1.0); /// /// let result = time_of_impact( diff --git a/src/plugins/debug/configuration.rs b/src/plugins/debug/configuration.rs index 51ca348f..e69f1854 100644 --- a/src/plugins/debug/configuration.rs +++ b/src/plugins/debug/configuration.rs @@ -331,7 +331,8 @@ impl PhysicsGizmos { /// // This rigid body and its collider and AABB will get rendered /// commands.spawn(( /// RigidBody::Dynamic, -/// Collider::ball(0.5), +#[cfg_attr(feature = "2d", doc = " Collider::circle(0.5),")] +#[cfg_attr(feature = "3d", doc = " Collider::sphere(0.5),")] /// // Overwrite default collider color (optional) /// DebugRender::default().with_collider_color(Color::RED), /// )); diff --git a/src/plugins/debug/gizmos.rs b/src/plugins/debug/gizmos.rs index f0959ced..ffe49ec8 100644 --- a/src/plugins/debug/gizmos.rs +++ b/src/plugins/debug/gizmos.rs @@ -128,13 +128,13 @@ impl<'w, 's> PhysicsGizmoExt for Gizmos<'w, 's, PhysicsGizmos> { #[cfg(feature = "2d")] { self.arrow_2d(a.f32(), b.f32(), color) - .with_tip_length(head_length); + .with_tip_length(head_length as f32); } #[cfg(feature = "3d")] { self.arrow(a.f32(), b.f32(), color) - .with_tip_length(head_length); + .with_tip_length(head_length as f32); } } @@ -408,7 +408,20 @@ impl<'w, 's> PhysicsGizmoExt for Gizmos<'w, 's, PhysicsGizmos> { color, ); } - TypedShape::Custom(_) => (), + TypedShape::Custom(_id) => + { + #[cfg(feature = "2d")] + if _id == 1 { + if let Some(ellipse) = collider.shape_scaled().as_shape::() { + self.primitive_2d( + ellipse.0, + position.f32(), + rotation.as_radians() as f32, + color, + ); + } + } + } } } diff --git a/src/plugins/debug/mod.rs b/src/plugins/debug/mod.rs index b7d691db..babc7187 100644 --- a/src/plugins/debug/mod.rs +++ b/src/plugins/debug/mod.rs @@ -2,6 +2,8 @@ //! //! See [`PhysicsDebugPlugin`]. +#![allow(clippy::unnecessary_cast)] + mod configuration; mod gizmos; @@ -52,7 +54,8 @@ use bevy::{ecs::query::Has, prelude::*, utils::intern::Interned}; /// // This rigid body and its collider and AABB will get rendered /// commands.spawn(( /// RigidBody::Dynamic, -/// Collider::ball(0.5), +#[cfg_attr(feature = "2d", doc = " Collider::circle(0.5),")] +#[cfg_attr(feature = "3d", doc = " Collider::sphere(0.5),")] /// // Overwrite default collider color (optional) /// DebugRender::default().with_collider_color(Color::RED), /// )); @@ -174,7 +177,7 @@ fn debug_render_axes( gizmos.circle_2d( global_com.f32(), // Scale dot size based on axis lengths - (lengths.x + lengths.y) / 20.0, + (lengths.x + lengths.y) as f32 / 20.0, center_color, ); #[cfg(feature = "3d")] @@ -182,7 +185,7 @@ fn debug_render_axes( global_com.f32(), rot.f32(), // Scale dot size based on axis lengths - (lengths.x + lengths.y + lengths.z) / 30.0, + (lengths.x + lengths.y + lengths.z) as f32 / 30.0, center_color, ); } @@ -303,10 +306,10 @@ fn debug_render_contacts( for manifold in contacts.manifolds.iter() { for contact in manifold.contacts.iter() { - let p1 = contact.global_point1(position1, rotation1).f32(); - let p2 = contact.global_point2(position2, rotation2).f32(); - let normal1 = contact.global_normal1(rotation1).f32(); - let normal2 = contact.global_normal2(rotation2).f32(); + let p1 = contact.global_point1(position1, rotation1); + let p2 = contact.global_point2(position2, rotation2); + let normal1 = contact.global_normal1(rotation1); + let normal2 = contact.global_normal2(rotation2); // Don't render contacts that aren't penetrating if contact.penetration <= Scalar::EPSILON { @@ -317,13 +320,13 @@ fn debug_render_contacts( if let Some(color) = config.contact_point_color { #[cfg(feature = "2d")] { - gizmos.circle_2d(p1, 3.0, color); - gizmos.circle_2d(p2, 3.0, color); + gizmos.circle_2d(p1.f32(), 3.0, color); + gizmos.circle_2d(p2.f32(), 3.0, color); } #[cfg(feature = "3d")] { - gizmos.sphere(p1, default(), 0.025, color); - gizmos.sphere(p2, default(), 0.025, color); + gizmos.sphere(p1.f32(), default(), 0.025, color); + gizmos.sphere(p2.f32(), default(), 0.025, color); } } diff --git a/src/plugins/spatial_query/mod.rs b/src/plugins/spatial_query/mod.rs index 83cfe8cb..d16458b8 100644 --- a/src/plugins/spatial_query/mod.rs +++ b/src/plugins/spatial_query/mod.rs @@ -96,12 +96,12 @@ //! //! # #[cfg(all(feature = "3d", feature = "f32"))] //! fn setup(mut commands: Commands) { -//! // Spawn a shape caster with a ball shape at the center travelling right +//! // Spawn a shape caster with a sphere shape at the center travelling right //! commands.spawn(ShapeCaster::new( -//! Collider::ball(0.5), // Shape -//! Vec3::ZERO, // Origin -//! Quat::default(), // Shape rotation -//! Vec3::X // Direction +//! Collider::sphere(0.5), // Shape +//! Vec3::ZERO, // Origin +//! Quat::default(), // Shape rotation +//! Vec3::X // Direction //! )); //! // ...spawn colliders and other things //! } diff --git a/src/plugins/spatial_query/query_filter.rs b/src/plugins/spatial_query/query_filter.rs index ae5ae0d7..c7cf8e48 100644 --- a/src/plugins/spatial_query/query_filter.rs +++ b/src/plugins/spatial_query/query_filter.rs @@ -12,7 +12,14 @@ use crate::prelude::*; #[cfg_attr(feature = "3d", doc = "use bevy_xpbd_3d::prelude::*;")] /// /// fn setup(mut commands: Commands) { -/// let object = commands.spawn(Collider::ball(0.5)).id(); +#[cfg_attr( + feature = "2d", + doc = " let object = commands.spawn(Collider::circle(0.5)).id();" +)] +#[cfg_attr( + feature = "3d", + doc = " let object = commands.spawn(Collider::sphere(0.5)).id();" +)] /// /// // A query filter that has three collision masks and excludes the `object` entity /// let query_filter = SpatialQueryFilter::new() diff --git a/src/plugins/spatial_query/shape_caster.rs b/src/plugins/spatial_query/shape_caster.rs index 72e6ed9a..3dbfa02c 100644 --- a/src/plugins/spatial_query/shape_caster.rs +++ b/src/plugins/spatial_query/shape_caster.rs @@ -34,7 +34,8 @@ use parry::query::details::TOICompositeShapeShapeBestFirstVisitor; /// fn setup(mut commands: Commands) { /// // Spawn a shape caster with a ball shape moving right starting from the origin /// commands.spawn(ShapeCaster::new( -/// Collider::ball(0.5), +#[cfg_attr(feature = "2d", doc = " Collider::circle(0.5),")] +#[cfg_attr(feature = "3d", doc = " Collider::sphere(0.5),")] /// Vec3::ZERO, /// Quat::default(), /// Vec3::X @@ -109,7 +110,10 @@ impl Default for ShapeCaster { fn default() -> Self { Self { enabled: true, - shape: Collider::ball(0.0), + #[cfg(feature = "2d")] + shape: Collider::circle(0.0), + #[cfg(feature = "3d")] + shape: Collider::sphere(0.0), origin: Vector::ZERO, global_origin: Vector::ZERO, #[cfg(feature = "2d")] diff --git a/src/plugins/spatial_query/system_param.rs b/src/plugins/spatial_query/system_param.rs index cd7ac3c6..05ecc9d2 100644 --- a/src/plugins/spatial_query/system_param.rs +++ b/src/plugins/spatial_query/system_param.rs @@ -290,13 +290,13 @@ impl<'w, 's> SpatialQuery<'w, 's> { /// fn print_hits(spatial_query: SpatialQuery) { /// // Cast ray and print first hit /// if let Some(first_hit) = spatial_query.cast_shape( - /// &Collider::ball(0.5), // Shape - /// Vec3::ZERO, // Origin - /// Quat::default(), // Shape rotation - /// Vec3::X, // Direction - /// 100.0, // Maximum time of impact (travel distance) - /// true, // Should initial penetration at the origin be ignored - /// SpatialQueryFilter::default(), // Query filter + /// &Collider::sphere(0.5), // Shape + /// Vec3::ZERO, // Origin + /// Quat::default(), // Shape rotation + /// Vec3::X, // Direction + /// 100.0, // Maximum time of impact (travel distance) + /// true, // Should initial penetration at the origin be ignored + /// SpatialQueryFilter::default(), // Query filter /// ) { /// println!("First hit: {:?}", first_hit); /// } @@ -354,14 +354,14 @@ impl<'w, 's> SpatialQuery<'w, 's> { /// fn print_hits(spatial_query: SpatialQuery) { /// // Cast shape and get all hits /// let hits = spatial_query.shape_hits( - /// &Collider::ball(0.5), // Shape - /// Vec3::ZERO, // Origin - /// Quat::default(), // Shape rotation - /// Vec3::X, // Direction - /// 100.0, // Maximum time of impact (travel distance) - /// 20, // Max hits - /// true, // Should initial penetration at the origin be ignored - /// SpatialQueryFilter::default(), // Query filter + /// &Collider::sphere(0.5), // Shape + /// Vec3::ZERO, // Origin + /// Quat::default(), // Shape rotation + /// Vec3::X, // Direction + /// 100.0, // Maximum time of impact (travel distance) + /// 20, // Max hits + /// true, // Should initial penetration at the origin be ignored + /// SpatialQueryFilter::default(), // Query filter /// ); /// /// // Print hits @@ -426,14 +426,14 @@ impl<'w, 's> SpatialQuery<'w, 's> { /// /// // Cast shape and get all hits /// spatial_query.shape_hits_callback( - /// &Collider::ball(0.5), // Shape - /// Vec3::ZERO, // Origin - /// Quat::default(), // Shape rotation - /// Vec3::X, // Direction - /// 100.0, // Maximum time of impact (travel distance) - /// true, // Should initial penetration at the origin be ignored - /// SpatialQueryFilter::default(), // Query filter - /// |hit| { // Callback function + /// &Collider::sphere(0.5), // Shape + /// Vec3::ZERO, // Origin + /// Quat::default(), // Shape rotation + /// Vec3::X, // Direction + /// 100.0, // Maximum time of impact (travel distance) + /// true, // Should initial penetration at the origin be ignored + /// SpatialQueryFilter::default(), // Query filter + /// |hit| { // Callback function /// hits.push(hit); /// true /// }, @@ -606,7 +606,7 @@ impl<'w, 's> SpatialQuery<'w, 's> { /// /// # #[cfg(all(feature = "3d", feature = "f32"))] /// fn print_aabb_intersections(spatial_query: SpatialQuery) { - /// let aabb = Collider::ball(0.5).compute_aabb(Vec3::ZERO, Quat::default()); + /// let aabb = Collider::sphere(0.5).compute_aabb(Vec3::ZERO, Quat::default()); /// let intersections = spatial_query.aabb_intersections_with_aabb(aabb); /// /// for entity in intersections.iter() { @@ -636,7 +636,7 @@ impl<'w, 's> SpatialQuery<'w, 's> { /// let mut intersections = vec![]; /// /// spatial_query.aabb_intersections_with_aabb_callback( - /// Collider::ball(0.5).compute_aabb(Vec3::ZERO, Quat::default()), + /// Collider::sphere(0.5).compute_aabb(Vec3::ZERO, Quat::default()), /// |entity| { /// intersections.push(entity); /// true @@ -679,10 +679,10 @@ impl<'w, 's> SpatialQuery<'w, 's> { /// # #[cfg(all(feature = "3d", feature = "f32"))] /// fn print_shape_intersections(spatial_query: SpatialQuery) { /// let intersections = spatial_query.shape_intersections( - /// &Collider::ball(0.5), // Shape - /// Vec3::ZERO, // Shape position - /// Quat::default(), // Shape rotation - /// SpatialQueryFilter::default(), // Query filter + /// &Collider::sphere(0.5), // Shape + /// Vec3::ZERO, // Shape position + /// Quat::default(), // Shape rotation + /// SpatialQueryFilter::default(), // Query filter /// ); /// /// for entity in intersections.iter() { @@ -727,11 +727,11 @@ impl<'w, 's> SpatialQuery<'w, 's> { /// let mut intersections = vec![]; /// /// spatial_query.shape_intersections_callback( - /// &Collider::ball(0.5), // Shape - /// Vec3::ZERO, // Shape position - /// Quat::default(), // Shape rotation - /// SpatialQueryFilter::default(), // Query filter - /// |entity| { // Callback function + /// &Collider::sphere(0.5), // Shape + /// Vec3::ZERO, // Shape position + /// Quat::default(), // Shape rotation + /// SpatialQueryFilter::default(), // Query filter + /// |entity| { // Callback function /// intersections.push(entity); /// true /// }, diff --git a/src/snapshots/bevy_xpbd_2d__bevy_xpbd__tests__body_with_velocity_moves.snap.new b/src/snapshots/bevy_xpbd_2d__bevy_xpbd__tests__body_with_velocity_moves.snap.new deleted file mode 100644 index edf3dffd..00000000 --- a/src/snapshots/bevy_xpbd_2d__bevy_xpbd__tests__body_with_velocity_moves.snap.new +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: crates/bevy_xpbd_2d/src/../../../src/tests.rs -assertion_line: 90 -expression: transform ---- -Transform { - translation: Vec3( - 8.316475, - 0.0, - 0.0, - ), - rotation: Quat( - 0.0, - 0.0, - 1.0, - -0.0, - ), - scale: Vec3( - 1.0, - 1.0, - 1.0, - ), -} diff --git a/src/snapshots/bevy_xpbd_2d__tests__body_with_velocity_moves.snap.new b/src/snapshots/bevy_xpbd_2d__tests__body_with_velocity_moves.snap.new deleted file mode 100644 index 6906111a..00000000 --- a/src/snapshots/bevy_xpbd_2d__tests__body_with_velocity_moves.snap.new +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: crates/bevy_xpbd_2d/../../src/tests.rs -assertion_line: 88 -expression: transform ---- -Transform { - translation: Vec3( - 8.316475, - 0.0, - 0.0, - ), - rotation: Quat( - 0.0, - 0.0, - 1.0, - -0.0, - ), - scale: Vec3( - 1.0, - 1.0, - 1.0, - ), -} diff --git a/src/snapshots/bevy_xpbd_3d__bevy_xpbd__tests__body_with_velocity_moves.snap.new b/src/snapshots/bevy_xpbd_3d__bevy_xpbd__tests__body_with_velocity_moves.snap.new deleted file mode 100644 index ff770b5a..00000000 --- a/src/snapshots/bevy_xpbd_3d__bevy_xpbd__tests__body_with_velocity_moves.snap.new +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: crates/bevy_xpbd_3d/src/../../../src/tests.rs -assertion_line: 90 -expression: transform ---- -Transform { - translation: Vec3( - 8.316475, - 0.0, - 0.0, - ), - rotation: Quat( - 0.0, - 0.0, - 0.0, - 1.0, - ), - scale: Vec3( - 1.0, - 1.0, - 1.0, - ), -} diff --git a/src/snapshots/bevy_xpbd_3d__tests__body_with_velocity_moves.snap.new b/src/snapshots/bevy_xpbd_3d__tests__body_with_velocity_moves.snap.new deleted file mode 100644 index f0dffa5e..00000000 --- a/src/snapshots/bevy_xpbd_3d__tests__body_with_velocity_moves.snap.new +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: crates/bevy_xpbd_3d/../../src/tests.rs -assertion_line: 88 -expression: transform ---- -Transform { - translation: Vec3( - 8.316475, - 0.0, - 0.0, - ), - rotation: Quat( - 0.0, - 0.0, - 0.0, - 1.0, - ), - scale: Vec3( - 1.0, - 1.0, - 1.0, - ), -} diff --git a/src/tests.rs b/src/tests.rs index 5afe672d..fc8da206 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -107,7 +107,10 @@ fn body_with_velocity_moves_on_first_frame() { SpatialBundle::default(), RigidBody::Dynamic, LinearVelocity(Vector::X), - MassPropertiesBundle::new_computed(&Collider::ball(0.5), 1.0), + #[cfg(feature = "2d")] + MassPropertiesBundle::new_computed(&Collider::circle(0.5), 1.0), + #[cfg(feature = "3d")] + MassPropertiesBundle::new_computed(&Collider::sphere(0.5), 1.0), )); }); @@ -133,7 +136,10 @@ fn body_with_velocity_moves() { SpatialBundle::default(), RigidBody::Dynamic, LinearVelocity(Vector::X), - MassPropertiesBundle::new_computed(&Collider::ball(0.5), 1.0), + #[cfg(feature = "2d")] + MassPropertiesBundle::new_computed(&Collider::circle(0.5), 1.0), + #[cfg(feature = "3d")] + MassPropertiesBundle::new_computed(&Collider::sphere(0.5), 1.0), )); });