pub struct PinConstraint {
pub anchor: Vec3,
pub stiffness: f32,
pub dead_zone: f32,
}Expand description
Pins a point to a fixed world-space position.
The correction snaps the constrained point back toward its anchor each step.
Fields§
§anchor: Vec3§stiffness: f32How strongly to pull (0 = no correction, 1 = snap to anchor immediately).
dead_zone: f32Max allowed deviation before pin activates (0 = always active).
Implementations§
Source§impl PinConstraint
impl PinConstraint
pub fn new(anchor: Vec3) -> Self
pub fn soft(anchor: Vec3, stiffness: f32) -> Self
pub fn with_dead_zone(self, zone: f32) -> Self
Sourcepub fn solve(&self, pos: Vec3) -> Vec3
pub fn solve(&self, pos: Vec3) -> Vec3
Compute position correction to apply to the constrained point.
pub fn move_anchor(&mut self, new_anchor: Vec3)
Trait Implementations§
Source§impl Clone for PinConstraint
impl Clone for PinConstraint
Source§fn clone(&self) -> PinConstraint
fn clone(&self) -> PinConstraint
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PinConstraint
impl RefUnwindSafe for PinConstraint
impl Send for PinConstraint
impl Sync for PinConstraint
impl Unpin for PinConstraint
impl UnsafeUnpin for PinConstraint
impl UnwindSafe for PinConstraint
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.