truncate static method
Clamps the magnitude of vector to max.
Implementation
static vm.Vector3 truncate(vm.Vector3 vector, double max) {
if (vector.length2 > max * max) {
return vector.normalized() * max;
}
return vector;
}
Clamps the magnitude of vector to max.
static vm.Vector3 truncate(vm.Vector3 vector, double max) {
if (vector.length2 > max * max) {
return vector.normalized() * max;
}
return vector;
}