clampScalar method
If this vector's x, y or z values are greater than the max value, they are replaced by the max value.
If this vector's x, y or z values are less than the min value, they are replaced by the min value.
Implementation
Vector3 clampScalar(double minVal, double maxVal) {
x = math.max(minVal, math.min(maxVal, x));
y = math.max(minVal, math.min(maxVal, y));
z = math.max(minVal, math.min(maxVal, z));
return this;
}