Skip to main content

MotorJointDef

Struct MotorJointDef 

Source
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

Source

pub fn raw(&self) -> &b3MotorJointDef

Returns the raw Box3D definition backing this builder.

Source

pub fn body_ids(self, body_a: BodyId, body_b: BodyId) -> Self

Sets the two bodies connected by the joint.

Source

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.

Source

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.

Source

pub fn collide_connected(self, collide_connected: bool) -> Self

Controls whether the connected bodies may collide with each other.

Source

pub fn force_threshold(self, threshold: f32) -> Self

Sets the force threshold, in newtons, used to emit joint events.

Source

pub fn torque_threshold(self, threshold: f32) -> Self

Sets the torque threshold, in newton-meters, used to emit joint events.

Source

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.

Source

pub fn draw_scale(self, draw_scale: f32) -> Self

Sets the scale used by native debug drawing for this joint.

Source

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

Source

pub fn new(body_a: BodyId, body_b: BodyId) -> Self

Creates a motor joint definition for two bodies.

Source

pub fn linear_velocity(self, velocity: impl Into<Vec3>) -> Self

Sets the desired relative linear velocity.

Source

pub fn angular_velocity(self, velocity: impl Into<Vec3>) -> Self

Sets the desired relative angular velocity.

Source

pub fn max_velocity_force(self, force: f32) -> Self

Sets the maximum force, in newtons, applied to reach the target linear velocity.

Source

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

Source§

fn clone(&self) -> MotorJointDef

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for MotorJointDef

Source§

impl Debug for MotorJointDef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MotorJointDef

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.