From 64b0d08c1488dff68386c90c3ef21ab9f6a36122 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Sat, 15 Jul 2023 23:14:44 +0300 Subject: [PATCH] user_data for joints --- src/dynamics/joint/generic_joint.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/dynamics/joint/generic_joint.rs b/src/dynamics/joint/generic_joint.rs index 649b857ad..5096e150a 100644 --- a/src/dynamics/joint/generic_joint.rs +++ b/src/dynamics/joint/generic_joint.rs @@ -223,6 +223,8 @@ pub struct GenericJoint { pub contacts_enabled: bool, /// Whether or not the joint is enabled. pub enabled: JointEnabled, + /// User-defined data associated to this joint. + pub user_data: u128, } impl Default for GenericJoint { @@ -238,6 +240,7 @@ impl Default for GenericJoint { motors: [JointMotor::default(); SPATIAL_DIM], contacts_enabled: true, enabled: JointEnabled::Enabled, + user_data: 0, } } } @@ -669,6 +672,12 @@ impl GenericJointBuilder { self } + /// An arbitrary user-defined 128-bit integer associated to the joints built by this builder. + pub fn user_data(mut self, data: u128) -> Self { + self.0.user_data = data; + self + } + /// Builds the generic joint. #[must_use] pub fn build(self) -> GenericJoint {