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>
impl<'w> DistanceJointBuilder<'w>
Sourcepub fn anchors_world<VA: Into<Vec2>, VB: Into<Vec2>>(self, a: VA, b: VB) -> Self
pub fn anchors_world<VA: Into<Vec2>, VB: Into<Vec2>>(self, a: VA, b: VB) -> Self
Set world-space anchors for A and B.
Sourcepub fn length_from_world_points<VA: Into<Vec2>, VB: Into<Vec2>>(
self,
a: VA,
b: VB,
) -> Self
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.
Sourcepub fn limit(self, min_len: f32, max_len: f32) -> Self
pub fn limit(self, min_len: f32, max_len: f32) -> Self
Enable limits with minimum/maximum length (meters).
Sourcepub fn motor(self, max_force: f32, speed: f32) -> Self
pub fn motor(self, max_force: f32, speed: f32) -> Self
Enable motor with maximum force (N) and speed (m/s).
Sourcepub fn spring(self, hertz: f32, damping_ratio: f32) -> Self
pub fn spring(self, hertz: f32, damping_ratio: f32) -> Self
Enable spring with stiffness (Hz) and damping ratio.
Sourcepub fn collide_connected(self, flag: bool) -> Self
pub fn collide_connected(self, flag: bool) -> Self
Allow bodies to collide while connected.
Sourcepub fn with_limit_and_motor(
self,
min_len: f32,
max_len: f32,
max_force: f32,
speed: f32,
) -> Self
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
Sourcepub fn with_limit_and_spring(
self,
min_len: f32,
max_len: f32,
hertz: f32,
damping_ratio: f32,
) -> Self
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
Sourcepub fn with_motor_and_spring(
self,
max_force: f32,
speed: f32,
hertz: f32,
damping_ratio: f32,
) -> Self
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
Sourcepub fn with_limit_motor_spring(
self,
min_len: f32,
max_len: f32,
max_force: f32,
speed: f32,
hertz: f32,
damping_ratio: f32,
) -> Self
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