user_data for joints

This commit is contained in:
Dmitry
2023-07-15 23:14:44 +03:00
parent 958fba8ed4
commit 64b0d08c14

View File

@@ -223,6 +223,8 @@ pub struct GenericJoint {
pub contacts_enabled: bool, pub contacts_enabled: bool,
/// Whether or not the joint is enabled. /// Whether or not the joint is enabled.
pub enabled: JointEnabled, pub enabled: JointEnabled,
/// User-defined data associated to this joint.
pub user_data: u128,
} }
impl Default for GenericJoint { impl Default for GenericJoint {
@@ -238,6 +240,7 @@ impl Default for GenericJoint {
motors: [JointMotor::default(); SPATIAL_DIM], motors: [JointMotor::default(); SPATIAL_DIM],
contacts_enabled: true, contacts_enabled: true,
enabled: JointEnabled::Enabled, enabled: JointEnabled::Enabled,
user_data: 0,
} }
} }
} }
@@ -669,6 +672,12 @@ impl GenericJointBuilder {
self 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. /// Builds the generic joint.
#[must_use] #[must_use]
pub fn build(self) -> GenericJoint { pub fn build(self) -> GenericJoint {