From d179d10e50b7faf56cfc7dc90395a3f91442f6ef Mon Sep 17 00:00:00 2001 From: Dmitry Stepanov Date: Sun, 14 Jun 2026 22:17:47 +0300 Subject: [PATCH] update to rapier 0.33 --- fyrox-autotile/Cargo.toml | 2 +- fyrox-core/Cargo.toml | 2 +- fyrox-impl/Cargo.toml | 8 +++--- fyrox-impl/src/scene/dim2/physics.rs | 39 ++++++++++++++++++-------- fyrox-impl/src/scene/graph/physics.rs | 40 +++++++++++++++++---------- fyrox-math/Cargo.toml | 4 +-- 6 files changed, 61 insertions(+), 34 deletions(-) diff --git a/fyrox-autotile/Cargo.toml b/fyrox-autotile/Cargo.toml index 928a69f73..ecc337d55 100644 --- a/fyrox-autotile/Cargo.toml +++ b/fyrox-autotile/Cargo.toml @@ -14,6 +14,6 @@ readme = "README.md" include = ["/src/**/*", "/Cargo.toml", "/LICENSE", "/README.md"] [dependencies] -nalgebra = { version = "0.34", features = ["bytemuck", "convert-glam030"] } +nalgebra = { version = "0.35", features = ["bytemuck", "convert-glam030"] } fxhash = "0.2.1" rand = "0.8" diff --git a/fyrox-core/Cargo.toml b/fyrox-core/Cargo.toml index 852820032..51b1f90e0 100644 --- a/fyrox-core/Cargo.toml +++ b/fyrox-core/Cargo.toml @@ -21,7 +21,7 @@ base64 = "0.22.1" byteorder = "1.4.3" rand = "0.8" memoffset = "0.9.0" -nalgebra = { version = "0.34", features = ["bytemuck", "convert-glam030"] } +nalgebra = { version = "0.35", features = ["bytemuck", "convert-glam030"] } arrayvec = "0.7.2" futures = { version = "0.3.17", features = ["thread-pool"] } uuid = { version = "1", features = ["v4", "js"] } diff --git a/fyrox-impl/Cargo.toml b/fyrox-impl/Cargo.toml index 56b3f845f..034de50be 100644 --- a/fyrox-impl/Cargo.toml +++ b/fyrox-impl/Cargo.toml @@ -27,8 +27,8 @@ fyrox-graphics-gl = { path = "../fyrox-graphics-gl", version = "2.0.0-rc.1" } fyrox-texture = { path = "../fyrox-texture", version = "2.0.0-rc.1" } fyrox-autotile = { path = "../fyrox-autotile", version = "2.0.0-rc.1" } fyrox-material = { path = "../fyrox-material", version = "2.0.0-rc.1" } -rapier2d = { version = "0.32", features = ["debug-render", ] } -rapier3d = { version = "0.32", features = ["debug-render"] } +rapier2d = { version = "0.33", features = ["debug-render", ] } +rapier3d = { version = "0.33", features = ["debug-render"] } image = { version = "0.25.1", default-features = false, features = ["gif", "jpeg", "png", "tga", "tiff", "bmp"] } inflate = "0.4.5" serde = { version = "1", features = ["derive"] } @@ -43,8 +43,8 @@ clap = { version = "4", features = ["derive"] } winit = { version = "0.30", features = ["serde"] } half = { version = "2.2.1", features = ["bytemuck"] } base64 = "0.22.1" -uvgen = "0.4.0" -lightmap = "0.6.0" +uvgen = "0.5.0" +lightmap = "0.7.0" libloading = "0.9" gltf = { version = "1.4.0", default-features = false, features = ["names", "utils", "extras", "KHR_materials_emissive_strength"] } bytemuck = { version = "1.23.2", features = ["derive"] } diff --git a/fyrox-impl/src/scene/dim2/physics.rs b/fyrox-impl/src/scene/dim2/physics.rs index 8ebccddb1..1eb2e54ce 100644 --- a/fyrox-impl/src/scene/dim2/physics.rs +++ b/fyrox-impl/src/scene/dim2/physics.rs @@ -1267,16 +1267,6 @@ impl PhysicsWorld { } if let Some(native) = self.joints.set.get_mut(joint.native.get(), false) { - joint.body1.try_sync_model(|v| { - if let Ok(rigid_body_node) = nodes.try_get(v) { - native.body1 = rigid_body_node.native.get(); - } - }); - joint.body2.try_sync_model(|v| { - if let Ok(rigid_body_node) = nodes.try_get(v) { - native.body2 = rigid_body_node.native.get(); - } - }); joint.params.try_sync_model(|v| { native.data = // Preserve local frames. @@ -1307,11 +1297,11 @@ impl PhysicsWorld { // wake up the bodies connected to the joint to ensure they respond to the motor changes immediately // however, the rigid bodies may fall asleep any time later unless Joint::set_motor_* functions are called periodically, // or the rigid bodies are set to cannot sleep - let Some(body1) = self.bodies.get_mut(native.body1) else { + let Some(body1) = self.bodies.get_mut(native.body1()) else { return; }; body1.wake_up(true); - let Some(body2) = self.bodies.get_mut(native.body2) else { + let Some(body2) = self.bodies.get_mut(native.body2()) else { return; }; body2.wake_up(true); @@ -1319,6 +1309,7 @@ impl PhysicsWorld { joint.contacts_enabled.try_sync_model(|v| { native.data.set_contacts_enabled(v); }); + let mut local_frames = joint.local_frames.borrow_mut(); if local_frames.is_none() { if let (Ok(body1), Ok(body2)) = @@ -1330,6 +1321,30 @@ impl PhysicsWorld { *local_frames = Some(JointLocalFrames::new(&local_frame1, &local_frame2)); } } + joint.body1.try_sync_model(|v| { + if let (Ok(rigid_body_node1), Ok(rigid_body_node2)) = + (nodes.try_get(v), nodes.try_get(*joint.body2)) + { + self.joints.set.set_bodies( + joint.native.get(), + rigid_body_node1.native.get(), + rigid_body_node2.native.get(), + false, + ); + } + }); + joint.body2.try_sync_model(|v| { + if let (Ok(rigid_body_node2), Ok(rigid_body_node1)) = + (nodes.try_get(v), nodes.try_get(*joint.body1)) + { + self.joints.set.set_bodies( + joint.native.get(), + rigid_body_node1.native.get(), + rigid_body_node2.native.get(), + false, + ); + } + }); } else { let body1_handle = joint.body1(); let body2_handle = joint.body2(); diff --git a/fyrox-impl/src/scene/graph/physics.rs b/fyrox-impl/src/scene/graph/physics.rs index 04a2f00d6..870e1cd8e 100644 --- a/fyrox-impl/src/scene/graph/physics.rs +++ b/fyrox-impl/src/scene/graph/physics.rs @@ -1786,18 +1786,7 @@ impl PhysicsWorld { joint.native.set(ImpulseJointHandle(Default::default())); return; } - if let Some(native) = self.joints.set.get_mut(joint.native.get(), false) { - joint.body1.try_sync_model(|v| { - if let Ok(rigid_body_node) = nodes.try_get(v) { - native.body1 = rigid_body_node.native.get(); - } - }); - joint.body2.try_sync_model(|v| { - if let Ok(rigid_body_node) = nodes.try_get(v) { - native.body2 = rigid_body_node.native.get(); - } - }); joint.params.try_sync_model(|v| { native.data = // Preserve local frames. @@ -1831,11 +1820,11 @@ impl PhysicsWorld { // wake up the bodies connected to the joint to ensure they respond to the motor changes immediately // however, the rigid bodies may fall asleep any time later unless Joint::set_motor_* functions are called periodically, // or the rigid bodies are set to cannot sleep - let Some(body1) = self.bodies.get_mut(native.body1) else { + let Some(body1) = self.bodies.get_mut(native.body1()) else { return; }; body1.wake_up(true); - let Some(body2) = self.bodies.get_mut(native.body2) else { + let Some(body2) = self.bodies.get_mut(native.body2()) else { return; }; body2.wake_up(true); @@ -1843,7 +1832,6 @@ impl PhysicsWorld { joint.contacts_enabled.try_sync_model(|v| { native.data.set_contacts_enabled(v); }); - let mut local_frames = joint.local_frames.borrow_mut(); if local_frames.is_none() { if let (Ok(body1), Ok(body2)) = @@ -1855,6 +1843,30 @@ impl PhysicsWorld { *local_frames = Some(JointLocalFrames::new(&local_frame1, &local_frame2)); } } + joint.body1.try_sync_model(|v| { + if let (Ok(rigid_body_node1), Ok(rigid_body_node2)) = + (nodes.try_get(v), nodes.try_get(*joint.body2)) + { + self.joints.set.set_bodies( + joint.native.get(), + rigid_body_node1.native.get(), + rigid_body_node2.native.get(), + false, + ); + } + }); + joint.body2.try_sync_model(|v| { + if let (Ok(rigid_body_node2), Ok(rigid_body_node1)) = + (nodes.try_get(v), nodes.try_get(*joint.body1)) + { + self.joints.set.set_bodies( + joint.native.get(), + rigid_body_node1.native.get(), + rigid_body_node2.native.get(), + false, + ); + } + }); } else { let body1_handle = joint.body1(); let body2_handle = joint.body2(); diff --git a/fyrox-math/Cargo.toml b/fyrox-math/Cargo.toml index 83fa8a38c..8fe5d12e7 100644 --- a/fyrox-math/Cargo.toml +++ b/fyrox-math/Cargo.toml @@ -14,8 +14,8 @@ repository = "https://github.com/FyroxEngine/Fyrox" rust-version = "1.87" [dependencies] -rectutils = "0.6.0" -nalgebra = { version = "0.34", features = ["bytemuck", "convert-glam030"] } +rectutils = "0.7.0" +nalgebra = { version = "0.35", features = ["bytemuck", "convert-glam030"] } arrayvec = "0.7.4" num-traits = "0.2.18" uuid = { version = "1", features = ["v4"] }