Fix string serialization for broadphase multisap (regions) (#710)

* serialize regions as vec
This commit is contained in:
Thierry Berger
2024-08-09 17:55:43 +02:00
committed by GitHub
parent ed133e1ea9
commit b66452b6c5
2 changed files with 9 additions and 1 deletions

View File

@@ -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

View File

@@ -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