Skip to main content

RevoluteJointDef

Struct RevoluteJointDef 

Source
pub struct RevoluteJointDef { /* private fields */ }
Expand description

Builder for a Box3D revolute joint.

A revolute joint fixes a point on body B to a point on body A and allows relative rotation about the joint z axis.

Implementations§

Source§

impl RevoluteJointDef

Source

pub fn raw(&self) -> &b3RevoluteJointDef

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 RevoluteJointDef

Source

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

Creates a revolute joint definition for two bodies.

Source

pub fn spring(self, enabled: bool, hertz: f32, damping_ratio: f32) -> Self

Enables or disables the angular spring and sets its tuning.

hertz is cycles per second and damping_ratio is dimensionless.

Source

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

Sets the target angle, in radians, for the angular spring.

Source

pub fn limit(self, enabled: bool, lower: f32, upper: f32) -> Self

Enables or disables angular limits and sets their angle range in radians.

Source

pub fn motor(self, enabled: bool, speed: f32, max_torque: f32) -> Self

Enables or disables the angular motor and sets speed and maximum torque.

speed is radians per second and max_torque is typically newton-meters.

Trait Implementations§

Source§

impl Clone for RevoluteJointDef

Source§

fn clone(&self) -> RevoluteJointDef

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 RevoluteJointDef

Source§

impl Debug for RevoluteJointDef

Source§

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

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

impl Default for RevoluteJointDef

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.