# Glm limit vector

Now that you can not use ofVec2f or ofVec3f… how can i do a limit in glm??

I mean i previously can do this, but how to do it now with glm

``````ofVec2f v;
v.set(2,3);
v.limit(19);
``````
``````glm::vec2 v(2.f, 3.f);
if (glm::length(v) > 19.f) {
v = glm::normalize(v) * 19.f;
}
``````

Thank you!

I’m a bit late but maybe someone will find it useful: you can use `glm::clamp(vector, minValue, maxValue)` or actually `glm::clamp(vector, -maxValue, maxValue)` if you want to get the same results as with the `vector.limit(maxValue)` function.

``````glm::vec2 v(2.0f, 3.0f);
v = glm::clamp(v, -19.0f, 19.0f);
``````