clampScalar method

Vector3 clampScalar(
  1. dynamic minVal,
  2. dynamic maxVal
)

Implementation

Vector3 clampScalar(minVal, 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;
}