Function sync_feedback

Source
pub fn sync_feedback<const N: usize>(
    feedback: &mut FeedbackController<N>,
) -> bool
Expand description

Apply the shared visual policy to an actual feedback consumer, returning whether its policy changed. Call before accepted-event emission and frame sampling, even with no simulation tick or while local menus are open.

Uses FeedbackController::set_policy: disabled channels clear pending shake, emphasis, hit-stop or flash immediately; re-enabling cannot revive those effects. Sound, rumble, event IDs and controller configuration survive. This opts the controller into the entire shared policy, including intensity.

use ferravex_math::Vec3;
use ferravex_play::feedback::{FeedbackController, FeedbackEvent, FeedbackPolicy};
use ferravex_render::preferences;
let mut feedback = FeedbackController::<8>::new(Default::default(), 1).unwrap();
feedback.emit(1, FeedbackEvent::hurt(Vec3::ZERO, 1.).unwrap()).unwrap();
preferences::set_feedback_policy(FeedbackPolicy::new(true, true, 1.).unwrap());
assert!(preferences::sync_feedback(&mut feedback));
assert_eq!(feedback.impact().flash, 0.);
assert_eq!(feedback.impact().emphasis, 0.);
assert!(!preferences::sync_feedback(&mut feedback));