21 const f32 speed = glm::length(velocity);
22 if (limit <= 0.0f || speed <= limit)
return velocity;
23 const f32 keep = std::pow(1.0f - glm::clamp(dampen, 0.0f, 1.0f), dt * 60.0f);
24 const f32 target = limit + (speed - limit) * keep;
25 return velocity * (target / speed);
glm::vec3 limitedVelocity(glm::vec3 velocity, f32 limit, f32 dampen, f32 dt)
A particle's velocity after its speed limit has pulled it back.