Skip to content

Commit

Permalink
Accessors for getting a joint, waking up
Browse files Browse the repository at this point in the history
  • Loading branch information
kvark committed Dec 9, 2023
1 parent 1b01ca4 commit 450b58b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,12 @@ impl Engine {
ObjectHandle(raw_handle)
}

pub fn wake_up(&mut self, object: ObjectHandle) {
let rb_handle = self.objects[object.0].rigid_body;
let rb = self.physics.rigid_bodies.get_mut(rb_handle).unwrap();
rb.wake_up(true);
}

pub fn add_joint(
&mut self,
a: ObjectHandle,
Expand All @@ -620,6 +626,9 @@ impl Engine {
)
}

pub fn get_joint(&self, handle: JointHandle) -> &rapier3d::dynamics::ImpulseJoint {
self.physics.impulse_joints.get(handle).unwrap()
}
pub fn get_joint_mut(&mut self, handle: JointHandle) -> &mut rapier3d::dynamics::ImpulseJoint {
self.physics.impulse_joints.get_mut(handle).unwrap()
}
Expand Down

0 comments on commit 450b58b

Please sign in to comment.