Class VectorUtils
java.lang.Object
dev.esophose.playerparticles.util.VectorUtils
public final class VectorUtils
extends java.lang.Object
-
Method Summary
Modifier and Type Method Description static double
angleToXAxis(org.bukkit.util.Vector vector)
Gets the angle toward the X axisstatic org.bukkit.util.Vector
rotateAroundAxisX(org.bukkit.util.Vector v, double angle)
Rotates a vector around the X axis at an anglestatic org.bukkit.util.Vector
rotateAroundAxisY(org.bukkit.util.Vector v, double angle)
Rotates a vector around the Y axis at an anglestatic org.bukkit.util.Vector
rotateAroundAxisZ(org.bukkit.util.Vector v, double angle)
Rotates a vector around the Z axis at an anglestatic org.bukkit.util.Vector
rotateVector(org.bukkit.util.Vector v, double angleX, double angleY, double angleZ)
Rotates a vector around the X, Y, and Z axesstatic org.bukkit.util.Vector
rotateVector(org.bukkit.util.Vector v, float yawDegrees, float pitchDegrees)
This handles non-unit vectors, with yaw and pitch instead of X,Y,Z angles.static org.bukkit.util.Vector
rotateVector(org.bukkit.util.Vector v, org.bukkit.Location location)
Rotate a vector about a location using that location's direction
-
Method Details
-
rotateAroundAxisX
public static org.bukkit.util.Vector rotateAroundAxisX(org.bukkit.util.Vector v, double angle)Rotates a vector around the X axis at an angle- Parameters:
v
- Starting vectorangle
- How much to rotate- Returns:
- The starting vector rotated
-
rotateAroundAxisY
public static org.bukkit.util.Vector rotateAroundAxisY(org.bukkit.util.Vector v, double angle)Rotates a vector around the Y axis at an angle- Parameters:
v
- Starting vectorangle
- How much to rotate- Returns:
- The starting vector rotated
-
rotateAroundAxisZ
public static org.bukkit.util.Vector rotateAroundAxisZ(org.bukkit.util.Vector v, double angle)Rotates a vector around the Z axis at an angle- Parameters:
v
- Starting vectorangle
- How much to rotate- Returns:
- The starting vector rotated
-
rotateVector
public static org.bukkit.util.Vector rotateVector(org.bukkit.util.Vector v, double angleX, double angleY, double angleZ)Rotates a vector around the X, Y, and Z axes- Parameters:
v
- The starting vectorangleX
- The change angle on XangleY
- The change angle on YangleZ
- The change angle on Z- Returns:
- The starting vector rotated
-
rotateVector
public static org.bukkit.util.Vector rotateVector(org.bukkit.util.Vector v, org.bukkit.Location location)Rotate a vector about a location using that location's direction- Parameters:
v
- The starting vectorlocation
- The location to rotate around- Returns:
- The starting vector rotated
-
rotateVector
public static org.bukkit.util.Vector rotateVector(org.bukkit.util.Vector v, float yawDegrees, float pitchDegrees)This handles non-unit vectors, with yaw and pitch instead of X,Y,Z angles. Thanks to SexyToad!- Parameters:
v
- The starting vectoryawDegrees
- The yaw offset in degreespitchDegrees
- The pitch offset in degrees- Returns:
- The starting vector rotated
-
angleToXAxis
public static double angleToXAxis(org.bukkit.util.Vector vector)Gets the angle toward the X axis- Parameters:
vector
- The vector to check- Returns:
- The angle toward the X axis
-