Show raw api
{
"functions": [
{
"name": "unpack",
"desc": "Splits a Vector into its components.",
"params": [
{
"name": "Vector",
"desc": "",
"lua_type": "Vector"
}
],
"returns": [
{
"desc": "",
"lua_type": "...number"
}
],
"function_type": "static",
"source": {
"line": 28,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "snap",
"desc": "Snaps a Vector to the nearest multiple of the given number for each coordinate.",
"params": [
{
"name": "vector",
"desc": "",
"lua_type": "Vector"
},
{
"name": "snapToNearestMultiple",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "Vector\n"
}
],
"function_type": "static",
"source": {
"line": 38,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "roundLength",
"desc": "Rounds a Vectors length to the nearest multiple of the given number.",
"params": [
{
"name": "vector",
"desc": "",
"lua_type": "Vector"
},
{
"name": "increment",
"desc": "",
"lua_type": "number"
}
],
"returns": [
{
"desc": "",
"lua_type": "Vector\n"
}
],
"function_type": "static",
"source": {
"line": 55,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "randomUnitVector",
"desc": "Returns a random unit vector3. Evenly distributes around the unit sphere.",
"params": [],
"returns": [
{
"desc": "",
"lua_type": "Vector3\n"
}
],
"function_type": "static",
"source": {
"line": 62,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "truncate",
"desc": "Truncates the length of a vector such that if it exceeds the given length, it will be truncated to that length.",
"params": [
{
"name": "Vector",
"desc": "The vector to truncate.",
"lua_type": "Vector"
},
{
"name": "maxLength",
"desc": "The maximum length of the vector.",
"lua_type": "number"
}
],
"returns": [
{
"desc": "The truncated vector.",
"lua_type": "Vector"
}
],
"function_type": "static",
"source": {
"line": 72,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "getAngle",
"desc": "Returns the angle of a Vector2 relative to the X axis.",
"params": [
{
"name": "vector",
"desc": "",
"lua_type": "Vector2"
}
],
"returns": [
{
"desc": "",
"lua_type": "number\n"
}
],
"function_type": "static",
"source": {
"line": 83,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "getAngleBetween",
"desc": "Returns the shortest angle between two vectors in Radians.",
"params": [
{
"name": "firstVector",
"desc": "",
"lua_type": "Vector"
},
{
"name": "secondVector",
"desc": "",
"lua_type": "Vector"
}
],
"returns": [
{
"desc": "",
"lua_type": "number\n"
}
],
"function_type": "static",
"source": {
"line": 90,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "getSignedAngleBetweenVector3s",
"desc": "Returns a signed angle in radians between two Vector3s around a given axis.\nThe sign is calculated counter-clockwise, left of first vector is positive, right of first vector is negative.",
"params": [
{
"name": "firstVector",
"desc": "The start of the angle",
"lua_type": "Vector3"
},
{
"name": "secondVector",
"desc": "The end of the angle",
"lua_type": "Vector3"
},
{
"name": "axis",
"desc": "The axis to rotate around",
"lua_type": "Vector3"
}
],
"returns": [
{
"desc": "The signed angle between the two vectors in radians.",
"lua_type": "number"
}
],
"function_type": "static",
"source": {
"line": 102,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "getSignedAngleBetweenVector2s",
"desc": "Returns a signed angle in radians between two vectors.\nThe sign is calculated counter-clockwise, left of first\nvector is positive, right of first vector is negative.",
"params": [
{
"name": "firstVector",
"desc": "The start of the angle",
"lua_type": "Vector2"
},
{
"name": "secondVector",
"desc": "The end of the angle",
"lua_type": "Vector2"
}
],
"returns": [
{
"desc": "The signed angle between the two vectors in radians.",
"lua_type": "number"
}
],
"function_type": "static",
"source": {
"line": 126,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "isNaN",
"desc": "Returns a CFrame that ... [DOCUMENTATION NEEDED] (Used for Slerping)",
"params": [
{
"name": "vector",
"desc": "",
"lua_type": "Vector"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean\n"
}
],
"function_type": "static",
"ignore": true,
"source": {
"line": 134,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "isNaN",
"desc": "Checks if a given vector is NaN.",
"params": [
{
"name": "vector",
"desc": "",
"lua_type": "Vector"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean\n"
}
],
"function_type": "static",
"source": {
"line": 145,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "abs",
"desc": "Returns the absolute value of the Vector",
"params": [
{
"name": "Vector",
"desc": "",
"lua_type": "Vector"
}
],
"returns": [
{
"desc": "",
"lua_type": "Vector\n"
}
],
"function_type": "static",
"source": {
"line": 152,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "sign",
"desc": "Returns a Vector where each component is the sign of the original Vector.",
"params": [
{
"name": "Vector",
"desc": "",
"lua_type": "Vector"
}
],
"returns": [
{
"desc": "",
"lua_type": "Vector\n"
}
],
"function_type": "static",
"source": {
"line": 162,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "normalize",
"desc": "Safely Normalizes a Vector.",
"params": [
{
"name": "Vector",
"desc": "",
"lua_type": "Vector"
}
],
"returns": [
{
"desc": "",
"lua_type": "Vector\n"
}
],
"function_type": "static",
"source": {
"line": 172,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "flattenY",
"desc": "Flattens a Vector3 on its Y axis",
"params": [
{
"name": "Vector",
"desc": "The Vector3 to flatten.",
"lua_type": "Vector3"
},
{
"name": "newY",
"desc": "the height to flatten the vector to. Defaults to 0.",
"lua_type": "number?"
}
],
"returns": [
{
"desc": "The flattened Vector3.",
"lua_type": "Vector3"
}
],
"function_type": "static",
"source": {
"line": 182,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "flatten",
"desc": "Flattens a given Vector3 on a specified axis",
"params": [
{
"name": "Vector",
"desc": "The Vector3 to flatten.",
"lua_type": "Vector3"
},
{
"name": "axis",
"desc": "The axis to flatten the vector on. Defaults to \"Y\".",
"lua_type": "Enum.Axis"
},
{
"name": "defaultValue",
"desc": "The value to set the flattened axis to. Defaults to 0.",
"lua_type": "number?"
}
],
"returns": [
{
"desc": "The flattened Vector3.",
"lua_type": "Vector3"
}
],
"function_type": "static",
"source": {
"line": 193,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "getAxis",
"desc": "Takes a Vector and removes all values except the specified Axis.",
"params": [
{
"name": "vector",
"desc": "The Vector to pull from",
"lua_type": "Vector3"
},
{
"name": "axis",
"desc": "The axis to get",
"lua_type": "Enum.Axis"
}
],
"returns": [
{
"desc": "The returned Vector containing only the specified axis.",
"lua_type": "Vector3"
}
],
"function_type": "static",
"source": {
"line": 212,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "setAxis",
"desc": "Takes a Vector and sets the axis value to the specified number.",
"params": [
{
"name": "vector",
"desc": "The Vector to change from",
"lua_type": "Vector3"
},
{
"name": "axis",
"desc": "The axis to set",
"lua_type": "Enum.Axis"
},
{
"name": "value",
"desc": "The new value of the axis",
"lua_type": "number"
}
],
"returns": [
{
"desc": "The adjusted Vector",
"lua_type": "Vector3"
}
],
"function_type": "static",
"source": {
"line": 223,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "rotateVector3",
"desc": "Rotates a vector about its axis by the given angles.\nTakes a CFrame.Angles object as the angles to rotate by. Works similarly to rotating a CFrame.\n\nrotateVector(Vector3.new(1,0,0), CFrame.Angles(0,math.pi,0)) -- Output: Vector3.new(-1,0,0)",
"params": [
{
"name": "vectorToRotate",
"desc": "The vector to rotate.",
"lua_type": "Vector3"
},
{
"name": "anglesToRotate",
"desc": "The angles to rotate the vector by. This should be given as a CFrame.Angles",
"lua_type": "CFrame"
}
],
"returns": [
{
"desc": "The rotated vector.",
"lua_type": "Vector3"
}
],
"function_type": "static",
"source": {
"line": 243,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "rotateVector2",
"desc": "Rotates a vector2 by a given amount of radians.",
"params": [
{
"name": "vectorToRotate",
"desc": "The vector to rotate.",
"lua_type": "Vector2"
},
{
"name": "angle",
"desc": "The angle [In Radians] to rotate the vector by.",
"lua_type": "number"
}
],
"returns": [
{
"desc": "The rotated vector.",
"lua_type": "Vector2"
}
],
"function_type": "static",
"source": {
"line": 253,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "rotateVector",
"desc": "Rotates a vector.",
"params": [
{
"name": "vector",
"desc": "",
"lua_type": "Vector"
},
{
"name": "...",
"desc": "",
"lua_type": "any"
}
],
"returns": [
{
"desc": "",
"lua_type": "Vector"
}
],
"function_type": "static",
"ignore": true,
"source": {
"line": 268,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "closestPointOnLine",
"desc": "Finds the closest point on a line to a given point.",
"params": [
{
"name": "refPoint",
"desc": "The point to find the closest point to.",
"lua_type": "Vector3"
},
{
"name": "linePoint",
"desc": "A point along the line.",
"lua_type": "Vector3"
},
{
"name": "lineDirection",
"desc": "The direction of the line.",
"lua_type": "Vector3"
}
],
"returns": [
{
"desc": "The closest point on the line to the reference point.",
"lua_type": "Vector3"
}
],
"function_type": "static",
"source": {
"line": 284,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "closestPointsBetweenLines",
"desc": "Finds the closest two points on two lines.\nThe lines are defined by some point along them and a direction",
"params": [
{
"name": "point1",
"desc": "A point along the first line.",
"lua_type": "Vector3"
},
{
"name": "direction1",
"desc": "The direction of the first line.",
"lua_type": "Vector3"
},
{
"name": "point2",
"desc": "A point along the second line.",
"lua_type": "Vector3"
},
{
"name": "direction2",
"desc": "The direction of the second line.",
"lua_type": "Vector3"
}
],
"returns": [
{
"desc": "The closest point on the first line.",
"lua_type": "Vector2"
},
{
"desc": "The closest point on the second line.",
"lua_type": "Vector2"
}
],
"function_type": "static",
"source": {
"line": 299,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "planeIntersectionPoint",
"desc": "Finds the intersection point of a line and a plane.",
"params": [
{
"name": "lineOrigin",
"desc": "A point along the line.",
"lua_type": "Vector3"
},
{
"name": "lineDirection",
"desc": "The direction of the line.",
"lua_type": "Vector3"
},
{
"name": "planeOrigin",
"desc": "A point on the plane.",
"lua_type": "Vector3"
},
{
"name": "planeNormal",
"desc": "The normal of the plane.",
"lua_type": "Vector3"
}
],
"returns": [
{
"desc": "The intersection point of the line and the plane if one exists.",
"lua_type": "Vector3?"
}
],
"function_type": "static",
"source": {
"line": 323,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "lineIntersectsSphere",
"desc": "Tests whether or not a line of infinite length intersects a sphere at some point.",
"params": [
{
"name": "lineOrigin",
"desc": "A point along the line.",
"lua_type": "Vector3"
},
{
"name": "lineDirection",
"desc": "The direction of the line.",
"lua_type": "Vector3"
},
{
"name": "sphereOrigin",
"desc": "The origin of the sphere.",
"lua_type": "Vector3"
},
{
"name": "sphereRadius",
"desc": "The radius of the sphere.",
"lua_type": "number"
}
],
"returns": [
{
"desc": "Whether or not the line intersects the sphere.",
"lua_type": "boolean"
}
],
"function_type": "static",
"source": {
"line": 343,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
},
{
"name": "lineSegmentIntersectsSphere",
"desc": "Tests whether or not a line **segment** intersects a sphere at some point.\nOnly returns true if the intersection point is between the two points of the line segment.",
"params": [
{
"name": "linePoint1",
"desc": "The start point of the line segment.",
"lua_type": "Vector3"
},
{
"name": "linePoint2",
"desc": "The end point of the line segment.",
"lua_type": "Vector3"
},
{
"name": "sphereOrigin",
"desc": "The center point of the sphere.",
"lua_type": "Vector3"
},
{
"name": "sphereRadius",
"desc": "The radius of the sphere.",
"lua_type": "number"
}
],
"returns": [
{
"desc": "Whether or not the line segment intersects the sphere.",
"lua_type": "boolean"
}
],
"function_type": "static",
"source": {
"line": 359,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
}
],
"properties": [],
"types": [
{
"name": "Vector",
"desc": "",
"lua_type": "Vector3 | Vector2",
"source": {
"line": 15,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
}
],
"name": "VectorUtil",
"desc": "A library of useful vector functions.",
"source": {
"line": 23,
"path": "src/railutils/src/RailUtil/VectorUtil.lua"
}
}