pub struct MotorJointDef { /* private fields */ }Expand description
Builder for a Box3D motor joint.
A motor joint drives relative linear and angular velocity between two bodies, with optional spring controls for position-style correction.
Implementations§
Source§impl MotorJointDef
impl MotorJointDef
Sourcepub fn raw(&self) -> &b3MotorJointDef
pub fn raw(&self) -> &b3MotorJointDef
Returns the raw Box3D definition backing this builder.
Sourcepub fn body_ids(self, body_a: BodyId, body_b: BodyId) -> Self
pub fn body_ids(self, body_a: BodyId, body_b: BodyId) -> Self
Sets the two bodies connected by the joint.
Sourcepub fn local_frame_a(self, frame: Transform) -> Self
pub fn local_frame_a(self, frame: Transform) -> Self
Sets the local constraint frame on body A.
Box3D measures joint local frames from each body’s origin, not from its center of mass. This keeps the joint stable when body shapes are later added, removed, or have mass recomputed.
Sourcepub fn local_frame_b(self, frame: Transform) -> Self
pub fn local_frame_b(self, frame: Transform) -> Self
Sets the local constraint frame on body B.
Box3D measures joint local frames from each body’s origin, not from its center of mass.
Sourcepub fn collide_connected(self, collide_connected: bool) -> Self
pub fn collide_connected(self, collide_connected: bool) -> Self
Controls whether the connected bodies may collide with each other.
Sourcepub fn force_threshold(self, threshold: f32) -> Self
pub fn force_threshold(self, threshold: f32) -> Self
Sets the force threshold, in newtons, used to emit joint events.
Sourcepub fn torque_threshold(self, threshold: f32) -> Self
pub fn torque_threshold(self, threshold: f32) -> Self
Sets the torque threshold, in newton-meters, used to emit joint events.
Sourcepub fn constraint_tuning(self, tuning: JointTuning) -> Self
pub fn constraint_tuning(self, tuning: JointTuning) -> Self
Sets the common constraint frequency and damping ratio.
The frequency is in hertz and the damping ratio is dimensionless.
Sourcepub fn draw_scale(self, draw_scale: f32) -> Self
pub fn draw_scale(self, draw_scale: f32) -> Self
Sets the scale used by native debug drawing for this joint.
Sourcepub unsafe fn raw_user_data(self, user_data: *mut c_void) -> Self
pub unsafe fn raw_user_data(self, user_data: *mut c_void) -> Self
Sets the raw Box3D userData pointer on this joint definition.
§Safety
The caller must ensure the pointer remains valid for every native Box3D use and
must not rely on boxddd to manage, alias-check, or drop the pointed-to value.
Source§impl MotorJointDef
impl MotorJointDef
Sourcepub fn new(body_a: BodyId, body_b: BodyId) -> Self
pub fn new(body_a: BodyId, body_b: BodyId) -> Self
Creates a motor joint definition for two bodies.
Sourcepub fn linear_velocity(self, velocity: impl Into<Vec3>) -> Self
pub fn linear_velocity(self, velocity: impl Into<Vec3>) -> Self
Sets the desired relative linear velocity.
Sourcepub fn angular_velocity(self, velocity: impl Into<Vec3>) -> Self
pub fn angular_velocity(self, velocity: impl Into<Vec3>) -> Self
Sets the desired relative angular velocity.
Sourcepub fn max_velocity_force(self, force: f32) -> Self
pub fn max_velocity_force(self, force: f32) -> Self
Sets the maximum force, in newtons, applied to reach the target linear velocity.
Sourcepub fn max_velocity_torque(self, torque: f32) -> Self
pub fn max_velocity_torque(self, torque: f32) -> Self
Sets the maximum torque, in newton-meters, applied to reach the target angular velocity.
Trait Implementations§
Source§impl Clone for MotorJointDef
impl Clone for MotorJointDef
Source§fn clone(&self) -> MotorJointDef
fn clone(&self) -> MotorJointDef
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more