diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-23 15:02:08 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-03-23 15:02:08 +0100 |
commit | 5b9d7b18603143160b2bfa5b57bd75b512ce9168 (patch) | |
tree | 515782968b045b2d32021c7fe9f4174f384c1190 /src | |
parent | f66346f89796ae109fc1ba4269764fadd9fcfeab (diff) |
a
Diffstat (limited to 'src')
-rw-r--r-- | src/critter.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/critter.cpp b/src/critter.cpp index 6aec78c8..90941860 100644 --- a/src/critter.cpp +++ b/src/critter.cpp @@ -198,8 +198,7 @@ void critter::update_movement(size_t i, const Ns& dt, rotation new_r) using Frac = decltype(critter::offset_frac_); constexpr auto frac = (float{limits<Frac>::max}+1)/2; constexpr auto inv_frac = 1 / frac; - const auto sign_vec = Math::sign(vec); - const auto from_accum = (offset_frac_*inv_frac) * sign_vec.normalized(); + const auto from_accum = offset_frac_ * inv_frac * vec; auto offset_ = vec + from_accum; auto off_i = Vector2i(offset_); if (!off_i.isZero()) |