pub struct IkChain {
pub joints: Vec<IkJoint>,
pub root_pin: Vec3,
pub total_length: f32,
pub tolerance: f32,
pub fixed_root: bool,
}Expand description
A chain of joints that IK solvers operate on.
Fields§
§joints: Vec<IkJoint>§root_pin: Vec3Root joint is pinned to this world-space position.
total_length: f32Total reach of the chain.
tolerance: f32Position tolerance: solver stops when end-effector is within this distance.
fixed_root: boolWhether the root joint can move (false = fixed root).
Implementations§
Source§impl IkChain
impl IkChain
Sourcepub fn new(positions: Vec<Vec3>) -> Self
pub fn new(positions: Vec<Vec3>) -> Self
Build a chain from a list of joint positions. Bone lengths are computed from consecutive positions.
Sourcepub fn uniform(
root: Vec3,
count: usize,
bone_length: f32,
direction: Vec3,
) -> Self
pub fn uniform( root: Vec3, count: usize, bone_length: f32, direction: Vec3, ) -> Self
Build a chain from a root position, bone directions, and uniform bone length.
pub fn with_tolerance(self, t: f32) -> Self
Sourcepub fn end_effector(&self) -> Vec3
pub fn end_effector(&self) -> Vec3
End-effector position (last joint).
Sourcepub fn bone_count(&self) -> usize
pub fn bone_count(&self) -> usize
Number of bones in the chain.
Sourcepub fn rebuild_from_root(&mut self)
pub fn rebuild_from_root(&mut self)
Reconstruct all joint positions from root_pin, preserving bone lengths.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IkChain
impl RefUnwindSafe for IkChain
impl Send for IkChain
impl Sync for IkChain
impl Unpin for IkChain
impl UnsafeUnpin for IkChain
impl UnwindSafe for IkChain
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.