Fixed velocity swap in ai function