pub struct ControlFollowTracker { /* private fields */ }Expand description
Watches the window after a touch to decide, by outcome, whether the touch was a control touch: did the toucher stay with the ball (close and speed-matched) or earn the follow-up touch? Resolutions are applied retroactively to the already-emitted touch event, mirroring how ball-movement credit is finalized.
At most one window is open at a time: any new touch closes the previous window, so the tracker never accumulates state.
Implementations§
Source§impl ControlFollowTracker
impl ControlFollowTracker
Sourcepub fn window_player(&self) -> Option<&PlayerId>
pub fn window_player(&self) -> Option<&PlayerId>
The player whose follow window is open, so the caller can supply that
player’s frame sample to Self::advance.
Sourcepub fn open(&mut self, touch_index: usize, player_id: &PlayerId, time: f32)
pub fn open(&mut self, touch_index: usize, player_id: &PlayerId, time: f32)
Open a follow window for a just-emitted touch event. Only call this for touches whose action watches the possession axis (pass/neutral/clear/boom).
Sourcepub fn observe_touch(
&mut self,
player_id: &PlayerId,
time: f32,
) -> Option<PossessionResolution>
pub fn observe_touch( &mut self, player_id: &PlayerId, time: f32, ) -> Option<PossessionResolution>
Resolve any open window against a new touch. A follow-up touch by the same player within the window confirms possession directly (the touch enabled a follow-up) — control if the ball stayed close, advance if it was played into space first; a touch by anyone else, or a late follow-up, closes the window on the stay-close criterion.
Sourcepub fn advance(
&mut self,
frame: &FrameInfo,
ball_position: Option<Vec3>,
ball_velocity: Option<Vec3>,
player_position: Option<Vec3>,
player_velocity: Option<Vec3>,
) -> Option<PossessionResolution>
pub fn advance( &mut self, frame: &FrameInfo, ball_position: Option<Vec3>, ball_velocity: Option<Vec3>, player_position: Option<Vec3>, player_velocity: Option<Vec3>, ) -> Option<PossessionResolution>
Accumulate one frame of follow data for the open window and resolve it once it ages out. Missing ball or player data counts as uncontrolled time (a demolished toucher is not in control of anything).
Sourcepub fn flush(&mut self) -> Option<PossessionResolution>
pub fn flush(&mut self) -> Option<PossessionResolution>
Close any open window immediately (live-play boundary or end of replay) on the stay-close criterion.