Now used MathUtils.clamp instead of just a cast. (Saver way)