Skip to content

Instantly share code, notes, and snippets.

@rvishwajith
Created January 13, 2021 06:00
Show Gist options
  • Save rvishwajith/6156fad4a747d1f3f69371c2cd568f46 to your computer and use it in GitHub Desktop.
Save rvishwajith/6156fad4a747d1f3f69371c2cd568f46 to your computer and use it in GitHub Desktop.
limitSpeed(Boid b)
Double maxMag = 0.033 // note this is a double, not a vector
IF magnitude(b.velocity) > maxMag
b.velocity = (b.velocity / magnitude(b.velocity)) * maxMag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment