pub struct FootPlantThresholds {
pub enter_distance: f32,
pub enter_normal_y: f32,
pub exit_normal_y: f32,
pub release_delay: f32,
}Expand description
Contact acquisition and retention rules for FootPlant::with_thresholds.
A new support must be within enter_distance and have normal.y strictly
above enter_normal_y. The current support may use the full maximum
correction distance and the lower exit_normal_y threshold. Both distance
limits are inclusive. A support change always uses the acquisition rules.
use ferravex_play::animation::{FootContact, FootPlant, FootPlantThresholds};
use ferravex_math::Vec3;
let thresholds = FootPlantThresholds {
enter_distance: 0.3,
enter_normal_y: 0.6,
exit_normal_y: 0.4,
release_delay: 0.05,
};
let mut foot = FootPlant::with_thresholds(0.5, 0.05, thresholds)?;
assert_eq!(foot.thresholds(), thresholds);
let contact = FootContact {
position: Vec3::Y * 0.2,
normal: Vec3::Y,
support: 7,
support_delta: Vec3::ZERO,
};
let pose = foot.update(Vec3::ZERO, Some(contact), true, 0.05)?;
assert_eq!(foot.support(), Some(7));
assert_eq!(foot.pose(), pose);
assert!((foot.correction().y - 0.1).abs() < 1e-6);
// One short query dropout holds the anchor and its correction.
assert_eq!(foot.update(Vec3::ZERO, None, true, 0.01)?, pose);Fields§
§enter_distance: f32Finite acquisition distance in 0..=max_correction.
enter_normal_y: f32Finite, strict minimum upward normal component in 0..1.
exit_normal_y: f32Finite retention threshold in 0..=enter_normal_y.
release_delay: f32Seconds of marginal/missing contact tolerated in 0..=0.25.
At this duration the anchor releases; zero disables the grace period.
Trait Implementations§
Source§impl Clone for FootPlantThresholds
impl Clone for FootPlantThresholds
Source§fn clone(&self) -> FootPlantThresholds
fn clone(&self) -> FootPlantThresholds
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 moreSource§impl Debug for FootPlantThresholds
impl Debug for FootPlantThresholds
Source§impl PartialEq for FootPlantThresholds
impl PartialEq for FootPlantThresholds
impl Copy for FootPlantThresholds
impl StructuralPartialEq for FootPlantThresholds
Auto Trait Implementations§
impl Freeze for FootPlantThresholds
impl RefUnwindSafe for FootPlantThresholds
impl Send for FootPlantThresholds
impl Sync for FootPlantThresholds
impl Unpin for FootPlantThresholds
impl UnwindSafe for FootPlantThresholds
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