Skip to content

Commit

Permalink
Merge pull request #505 from mrDIMAS/master
Browse files Browse the repository at this point in the history
`user_data` for joints
  • Loading branch information
sebcrozet authored Sep 9, 2023
2 parents 39a8395 + 64b0d08 commit dfb4f2a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/dynamics/joint/generic_joint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -238,6 +240,7 @@ impl Default for GenericJoint {
motors: [JointMotor::default(); SPATIAL_DIM],
contacts_enabled: true,
enabled: JointEnabled::Enabled,
user_data: 0,
}
}
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit dfb4f2a

Please sign in to comment.