add helper to specifically set a vector's length along it's direction
This commit is contained in:
parent
05dd4a1de0
commit
513eff7cb5
|
@ -206,6 +206,13 @@ public final class MathHelpers {
|
|||
result.z = desiredSize.z / originalSize.z;
|
||||
}
|
||||
|
||||
public static void setLengthOf(Vector3 v, float length) {
|
||||
float scaleFactor = length / v.len();
|
||||
v.x = v.x * scaleFactor;
|
||||
v.y = v.y * scaleFactor;
|
||||
v.z = v.z * scaleFactor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Basically the same as {@link com.badlogic.gdx.math.Intersector#getLowestPositiveRoot} except for the addition
|
||||
* of a parameter maxR which limits the maximum root value we accept. Anything over this will also result
|
||||
|
|
Loading…
Reference in a new issue