pub struct InterpolationState {
pub prev: WorldSnapshot,
pub current: WorldSnapshot,
}Expand description
Interpolation state manager
Stores two snapshots (previous and current) and provides alpha-blended positions/rotations for rendering.
Fields§
§prev: WorldSnapshotPrevious physics state
current: WorldSnapshotCurrent physics state
Implementations§
Source§impl InterpolationState
impl InterpolationState
Sourcepub const fn new(prev: WorldSnapshot, current: WorldSnapshot) -> Self
pub const fn new(prev: WorldSnapshot, current: WorldSnapshot) -> Self
Create from two snapshots
Sourcepub fn push(&mut self, new_state: WorldSnapshot)
pub fn push(&mut self, new_state: WorldSnapshot)
Push new physics state (current becomes prev)
Sourcepub fn capture_and_push(&mut self, world: &PhysicsWorld)
pub fn capture_and_push(&mut self, world: &PhysicsWorld)
Capture and push from physics world
Sourcepub fn interpolate_position(&self, body_idx: usize, alpha: Fix128) -> Vec3Fix
pub fn interpolate_position(&self, body_idx: usize, alpha: Fix128) -> Vec3Fix
Get interpolated position for a body
alpha is in [0, 1]: 0 = previous state, 1 = current state
Sourcepub fn interpolate_rotation(&self, body_idx: usize, alpha: Fix128) -> QuatFix
pub fn interpolate_rotation(&self, body_idx: usize, alpha: Fix128) -> QuatFix
Get interpolated rotation for a body (SLERP)
Sourcepub fn interpolate(&self, body_idx: usize, alpha: Fix128) -> (Vec3Fix, QuatFix)
pub fn interpolate(&self, body_idx: usize, alpha: Fix128) -> (Vec3Fix, QuatFix)
Get both interpolated position and rotation
Sourcepub fn interpolate_all(&self, alpha: Fix128) -> Vec<(Vec3Fix, QuatFix)>
pub fn interpolate_all(&self, alpha: Fix128) -> Vec<(Vec3Fix, QuatFix)>
Get all interpolated transforms
Sourcepub fn body_count(&self) -> usize
pub fn body_count(&self) -> usize
Number of bodies available for interpolation
Auto Trait Implementations§
impl Freeze for InterpolationState
impl RefUnwindSafe for InterpolationState
impl Send for InterpolationState
impl Sync for InterpolationState
impl Unpin for InterpolationState
impl UnsafeUnpin for InterpolationState
impl UnwindSafe for InterpolationState
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> 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> ⓘ
Converts
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> ⓘ
Converts
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