Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Math = {}
- function Math.convert(value)
- value = (value + 1)*math.pi
- return (math.cos(value)/2 + 0.5)
- end
- function Math.Round(number, i)
- number = number or 0
- i = i or 0
- local n = 10^i
- return math.round(number*n)/n
- end
- function Math.Lerp(startValue, finishValue, n)
- return startValue + (finishValue - startValue) * n
- end
- function Math.ConvertVector2ToVector3(vector, axis)
- local x = 0
- local y = 0
- local z = 0
- if axis == Enum.Axis.X then
- x = 0
- y = vector.Y
- z = vector.X
- elseif axis == Enum.Axis.Z then
- x = vector.X
- y = vector.Y
- z = 0
- else
- x = vector.X
- y = 0
- z = vector.Y
- end
- return Vector3.new(x, y, z)
- end
- function Math.RandomVector2(min, max)
- local x = math.random(min, max)
- local y = math.random(min, max)
- return Vector2.new(x, y)
- end
- function Math.RandomVector3(min, max)
- local x = math.random(min, max)
- local y = math.random(min, max)
- local z = math.random(min, max)
- return Vector3.new(x, y, z)
- end
- function Math.ConvertOrientationToVector2(angle)
- return Vector2.new(math.cos(angle), math.sin(angle))
- end
- function Math.ConvertOrientationToVector3(vX, vY, vZ)
- local x = vY.X + 0 + vZ.X
- local y = 0 + vX.Y + vZ.Y
- local z = vX.X + vY.Y + 0
- return Vector3.new(x, y, z).Unit
- end
- function Math.RandomDirection2()
- local direction = math.random()*math.pi*2
- return Math.ConvertOrientationToVector2(direction)
- end
- function Math.RandomDirection3()
- local vX = Math.RandomDirection2()
- local vY = Math.RandomDirection2()
- local vZ = Math.RandomDirection2()
- return Math.ConvertOrientationToVector3(vX, vY, vZ)
- end
- return Math
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement