pub struct Pose { /* private fields */ }Expand description
A mutable snapshot of a skeleton’s joint poses with world-space helpers.
Obtain one from AnimationPlayer::compute_pose. Optionally modify joints
for IK, then call skinning_matrices to get
the final matrices ready for a SkinningBatch.
let mut pose = player.compute_pose();
let foot = skeleton.joint_index_by_name("foot_l").unwrap();
let lower = skeleton.joint_index_by_name("lower_leg_l").unwrap();
let upper = skeleton.joint_index_by_name("upper_leg_l").unwrap();
// analytic two-bone IK — you supply the math, Pose handles local/world conversion
let (r_upper, r_lower) = two_bone_ik(
pose.world_position(upper),
pose.world_position(lower),
target_foot_pos,
);
pose.set_world_rotation(upper, r_upper);
pose.set_world_rotation(lower, r_lower);
let matrices = pose.skinning_matrices();Implementations§
Source§impl Pose
impl Pose
Sourcepub fn world_position(&mut self, joint: usize) -> Vec3
pub fn world_position(&mut self, joint: usize) -> Vec3
World-space position of joint (origin of its local frame).
Sourcepub fn world_rotation(&mut self, joint: usize) -> Quat
pub fn world_rotation(&mut self, joint: usize) -> Quat
World-space rotation of joint.
Sourcepub fn world_matrix(&mut self, joint: usize) -> Mat4
pub fn world_matrix(&mut self, joint: usize) -> Mat4
Full world-space matrix of joint — position, rotation, and scale in
one shot. Multiply by the entity’s own world matrix to get game-world space.
Sourcepub fn set_world_rotation(&mut self, joint: usize, rotation: Quat)
pub fn set_world_rotation(&mut self, joint: usize, rotation: Quat)
Set joint’s orientation in world space. Converts to local
(parent-relative) rotation automatically — no matrix math on your side.
Sourcepub fn set_world_position(&mut self, joint: usize, position: Vec3)
pub fn set_world_position(&mut self, joint: usize, position: Vec3)
Set joint’s position in world space. Converts to local
(parent-relative) translation automatically.
Sourcepub fn set_local(&mut self, joint: usize, t: Transform)
pub fn set_local(&mut self, joint: usize, t: Transform)
Directly set joint’s local (parent-relative) transform.
Use when you already have the correct local-space value.
Sourcepub fn skeleton(&self) -> &Skeleton
pub fn skeleton(&self) -> &Skeleton
Access the underlying skeleton — for name lookups, joint count, etc.
Sourcepub fn skinning_matrices(&self) -> Vec<Mat4>
pub fn skinning_matrices(&self) -> Vec<Mat4>
Compute skinning matrices from the current (possibly IK-modified) pose,
ready to write into a SkinnedBatchRenderer.
Auto Trait Implementations§
impl Freeze for Pose
impl RefUnwindSafe for Pose
impl Send for Pose
impl Sync for Pose
impl Unpin for Pose
impl UnsafeUnpin for Pose
impl UnwindSafe for Pose
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> Component for T
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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more