Skip to content

Instantly share code, notes, and snippets.

@PranavSK
Created March 24, 2021 05:27
Show Gist options
  • Save PranavSK/89d329c75f0c37ef82525d0b7d4144f6 to your computer and use it in GitHub Desktop.
Save PranavSK/89d329c75f0c37ef82525d0b7d4144f6 to your computer and use it in GitHub Desktop.
class_name MathUtils
static func clamp_magnitude(vector, amount):
return vector if vector.length() < abs(amount) else vector.normalized() * amount
static func get_aabb_center(bounds: AABB) -> Vector3:
return bounds.position + bounds.size / 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment