Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples/hugs: Steer the AI using constant-velocity intercepts
Instead of moving towards the humans, move the AI towards the point where its trajectory will intersect with the human's, assuming constant velocities. The assumption of constant velocities is violated in several ways: 1. the humans have slight, random angular motion, rather than going in straight lines; 2. the humans bounce off the sides of the game area; 3. once the AI gets close enough, the humans get scared, speeding up themselves and the AI. As the intercepts are recomputed at each frame, the random perturbations (1) are smoothly followed by the AI. Unlike those, (2) and (3) are large, punctual changes in velocity; those result in slightly-suboptimal steering (i.e. a better AI could catch up slightly faster) and discontinuities (i.e. the AI suddenly changes direction when its target bounces or gets close enough to be scared).
- Loading branch information