aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Berger <contact@thierryberger.com>2024-08-09 17:55:43 +0200
committerGitHub <noreply@github.com>2024-08-09 17:55:43 +0200
commitb66452b6c5d0834043bfe24e9b1597c0e554d40a (patch)
treeef42489614b8e2d839f456959be7978f5c6c200d
parented133e1ea9fca451ed8b06ea2c7d067990975bf6 (diff)
downloadrapier-b66452b6c5d0834043bfe24e9b1597c0e554d40a.tar.gz
rapier-b66452b6c5d0834043bfe24e9b1597c0e554d40a.tar.bz2
rapier-b66452b6c5d0834043bfe24e9b1597c0e554d40a.zip
Fix string serialization for broadphase multisap (regions) (#710)
* serialize regions as vec
-rw-r--r--CHANGELOG.md3
-rw-r--r--src/geometry/broad_phase_multi_sap/sap_layer.rs7
2 files changed, 9 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9f109ca..e6a110a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,7 @@
### Fix
- The region key has been replaced by an i64 in the f64 version of rapier, increasing the range before panics occur.
+- Fix `BroadphaseMultiSap` not being able to serialize correctly with serde_json.
### Modified
@@ -14,7 +15,7 @@
- Fix crash when removing a multibody joint, or a rigid-body with a multipody-joint attached to it.
- Fix crash when inserting multibody joints in an arbitrary order (instead of incrementally from root to leaf).
-- Fix `BroadphaseMultiSap` not being able to serialize correctly with serde_json.
+- Fix `BroadphaseMultiSap` not being able to serialize a field with serde_json.
### Added
diff --git a/src/geometry/broad_phase_multi_sap/sap_layer.rs b/src/geometry/broad_phase_multi_sap/sap_layer.rs
index 80d920a..241f8d2 100644
--- a/src/geometry/broad_phase_multi_sap/sap_layer.rs
+++ b/src/geometry/broad_phase_multi_sap/sap_layer.rs
@@ -13,6 +13,13 @@ pub(crate) struct SAPLayer {
pub smaller_layer: Option<u8>,
pub larger_layer: Option<u8>,
region_width: Real,
+ #[cfg_attr(
+ feature = "serde-serialize",
+ serde(
+ serialize_with = "crate::utils::serde::serialize_to_vec_tuple",
+ deserialize_with = "crate::utils::serde::deserialize_from_vec_tuple"
+ )
+ )]
pub regions: HashMap<Point<RegionKey>, BroadPhaseProxyIndex>,
#[cfg_attr(feature = "serde-serialize", serde(skip))]
regions_to_potentially_remove: Vec<Point<RegionKey>>, // Workspace