- return result;
-}
-
-bool Steering::SumForce(glm::dvec3 &out, const glm::dvec3 &in, double max) const noexcept {
- if (allzero(in) || anynan(in)) {
- return false;
- }
- double cur = allzero(out) ? 0.0 : length(out);
- double rem = max - cur;
- if (rem < 0.0) {
- return true;
- }
- double add = length(in);
- if (add > rem) {
- // this method is off if in and out are in different
- // directions, but gives okayish results
- out += in * (1.0 / add);
- return true;
- } else {
- out += in;
- return false;