DistanceJointBuilder

Struct DistanceJointBuilder 

Source
pub struct DistanceJointBuilder<'w> { /* private fields */ }
Expand description

Fluent builder for distance joints working in world space.

Use anchors_world and length_from_world_points to configure anchors and target length without manually computing local frames.

Implementations§

Source§

impl<'w> DistanceJointBuilder<'w>

Source

pub fn anchors_world<VA: Into<Vec2>, VB: Into<Vec2>>(self, a: VA, b: VB) -> Self

Set world-space anchors for A and B.

Source

pub fn length(self, len: f32) -> Self

Set desired distance (meters).

Source

pub fn length_from_world_points<VA: Into<Vec2>, VB: Into<Vec2>>( self, a: VA, b: VB, ) -> Self

Compute desired distance from two world points.

Source

pub fn limit(self, min_len: f32, max_len: f32) -> Self

Enable limits with minimum/maximum length (meters).

Source

pub fn motor(self, max_force: f32, speed: f32) -> Self

Enable motor with maximum force (N) and speed (m/s).

Source

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

Enable spring with stiffness (Hz) and damping ratio.

Source

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

Allow bodies to collide while connected.

Source

pub fn with_limit_and_motor( self, min_len: f32, max_len: f32, max_force: f32, speed: f32, ) -> Self

Enable limits and motor together.

  • min_len/max_len: meters
  • max_force: Newtons
  • speed: meters/second
Source

pub fn with_limit_and_spring( self, min_len: f32, max_len: f32, hertz: f32, damping_ratio: f32, ) -> Self

Enable limits and spring together.

  • min_len/max_len: meters
  • hertz: stiffness (Hz), typical 4–20
  • damping_ratio: [0, 1], typical 0.1–0.7
Source

pub fn with_motor_and_spring( self, max_force: f32, speed: f32, hertz: f32, damping_ratio: f32, ) -> Self

Enable motor and spring together.

  • max_force: Newtons
  • speed: meters/second
  • hertz: stiffness (Hz), typical 4–20
  • damping_ratio: [0, 1], typical 0.1–0.7
Source

pub fn with_limit_motor_spring( self, min_len: f32, max_len: f32, max_force: f32, speed: f32, hertz: f32, damping_ratio: f32, ) -> Self

Enable limit, motor, and spring together.

  • min_len/max_len: meters
  • max_force: Newtons
  • speed: meters/second
  • hertz: stiffness (Hz), typical 4–20
  • damping_ratio: [0, 1], typical 0.1–0.7
Source

pub fn build(self) -> Joint<'w>

Source

pub fn try_build(self) -> ApiResult<Joint<'w>>

Source

pub fn build_owned(self) -> OwnedJoint

Source

pub fn try_build_owned(self) -> ApiResult<OwnedJoint>

Auto Trait Implementations§

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.