//This function adjusts the Vector so its x and y values do not exceed the max scalar value (Typically the MAX_FORCE). void Alien::Truncate(vec2 &vec, const float &scalar) { float retVal = scalar / vec.Length(); if (retVal < 1.0) { retVal = 1.0; } else { retVal =retVal; } vec *= retVal; }
float Length(vec2 v) { return v.Length(); }