pub struct DistanceConstraint<const D: usize> {
pub body_a: BodyHandle,
pub body_b: BodyHandle,
pub rest_length: f64,
pub stiffness: f64,
}Expand description
Distance constraint: keeps two bodies at a fixed distance.
Fields§
§body_a: BodyHandle§body_b: BodyHandle§rest_length: f64§stiffness: f64Trait Implementations§
Source§impl<const D: usize> Constraint<D> for DistanceConstraint<D>
impl<const D: usize> Constraint<D> for DistanceConstraint<D>
Source§fn bodies(&self) -> (BodyHandle, BodyHandle)
fn bodies(&self) -> (BodyHandle, BodyHandle)
The two bodies this constraint connects.
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Cast to std::any::Any for downcasting in tests/lab.
Source§fn solve(&self, body_a: &mut RigidBody<D>, body_b: &mut RigidBody<D>, _dt: f64)
fn solve(&self, body_a: &mut RigidBody<D>, body_b: &mut RigidBody<D>, _dt: f64)
Solve the constraint by applying positional corrections.
Called multiple times per frame for iterative convergence.
Source§fn solve_velocity(
&self,
body_a: &mut RigidBody<D>,
body_b: &mut RigidBody<D>,
_dt: f64,
_callback: Option<&mut dyn PhysicsCallback<D>>,
)
fn solve_velocity( &self, body_a: &mut RigidBody<D>, body_b: &mut RigidBody<D>, _dt: f64, _callback: Option<&mut dyn PhysicsCallback<D>>, )
Optional velocity-level correction (impulse-based, Fix 7).
Called after position solve for hybrid PBD+impulse dynamics.
Default: no-op (pure PBD).
Auto Trait Implementations§
impl<const D: usize> Freeze for DistanceConstraint<D>
impl<const D: usize> RefUnwindSafe for DistanceConstraint<D>
impl<const D: usize> Send for DistanceConstraint<D>
impl<const D: usize> Sync for DistanceConstraint<D>
impl<const D: usize> Unpin for DistanceConstraint<D>
impl<const D: usize> UnsafeUnpin for DistanceConstraint<D>
impl<const D: usize> UnwindSafe for DistanceConstraint<D>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.