@quenty/vector3utils 7.1.1-canary.d08dd64.0 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -2
- package/package.json +4 -4
- package/src/Shared/Vector3Utils.lua +22 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# [7.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/vector3utils@7.1.0...@quenty/vector3utils@7.2.0) (2024-01-08)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Add Vector3Utils.areClose ([1820b38](https://github.com/Quenty/NevermoreEngine/commit/1820b38ca52315925a85b1c4f45e10d4b448e96d))
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/vector3utils",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "Utilities involving Vector3 objects in Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/loader": "7.
|
|
29
|
-
"@quenty/math": "2.5.0"
|
|
28
|
+
"@quenty/loader": "^7.3.0",
|
|
29
|
+
"@quenty/math": "^2.5.0"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "075fb03a03f12ade8758f667767ba738204e0c4b"
|
|
35
35
|
}
|
|
@@ -11,6 +11,7 @@ local Vector3Utils = {}
|
|
|
11
11
|
|
|
12
12
|
--[=[
|
|
13
13
|
Creates a Vector3 from a Vector2 in the XY plane
|
|
14
|
+
|
|
14
15
|
@param vector2 Vector2
|
|
15
16
|
@return Vector3
|
|
16
17
|
]=]
|
|
@@ -20,6 +21,7 @@ end
|
|
|
20
21
|
|
|
21
22
|
--[=[
|
|
22
23
|
Creates a Vector3 from a Vector2 in the XZ plane
|
|
24
|
+
|
|
23
25
|
@param vector2 Vector2
|
|
24
26
|
@return Vector3
|
|
25
27
|
]=]
|
|
@@ -29,6 +31,7 @@ end
|
|
|
29
31
|
|
|
30
32
|
--[=[
|
|
31
33
|
Computes the angle between 2 vectors in radians
|
|
34
|
+
|
|
32
35
|
@param a Vector3
|
|
33
36
|
@param b Vector3
|
|
34
37
|
@return number?
|
|
@@ -54,6 +57,7 @@ end
|
|
|
54
57
|
|
|
55
58
|
--[=[
|
|
56
59
|
Computes the angle between 2 vectors in radians
|
|
60
|
+
|
|
57
61
|
@param a Vector3
|
|
58
62
|
@param b Vector3
|
|
59
63
|
@return number
|
|
@@ -66,6 +70,7 @@ end
|
|
|
66
70
|
|
|
67
71
|
--[=[
|
|
68
72
|
Spherically lerps between start and finish
|
|
73
|
+
|
|
69
74
|
@param start Vector3
|
|
70
75
|
@param finish Vector3
|
|
71
76
|
@param t number -- Amount to slerp. 0 is start, 1 is finish. beyond that is extended as expected.
|
|
@@ -81,6 +86,7 @@ end
|
|
|
81
86
|
|
|
82
87
|
--[=[
|
|
83
88
|
Constrains a Vector3 into a cone.
|
|
89
|
+
|
|
84
90
|
@param direction Vector3 -- The vector direction to constrain
|
|
85
91
|
@param coneDirection Vector3 -- The direction of the cone.
|
|
86
92
|
@param coneAngleRad -- Angle of the cone
|
|
@@ -114,4 +120,20 @@ function Vector3Utils.round(vector3: Vector3, amount: number): number
|
|
|
114
120
|
return Vector3.new(Math.round(vector3.x, amount), Math.round(vector3.y, amount), Math.round(vector3.z, amount))
|
|
115
121
|
end
|
|
116
122
|
|
|
123
|
+
--[=[
|
|
124
|
+
Checks if 2 Vector3 values are clsoe to each other
|
|
125
|
+
|
|
126
|
+
@param a Vector3
|
|
127
|
+
@param b Vector3
|
|
128
|
+
@param epsilon number
|
|
129
|
+
@return boolean
|
|
130
|
+
]=]
|
|
131
|
+
function Vector3Utils.areClose(a, b, epsilon)
|
|
132
|
+
assert(type(epsilon) == "number", "Bad epsilon")
|
|
133
|
+
|
|
134
|
+
return math.abs(a.x - b.x) <= epsilon
|
|
135
|
+
and math.abs(a.y - b.y) <= epsilon
|
|
136
|
+
and math.abs(a.z - b.z) <= epsilon
|
|
137
|
+
end
|
|
138
|
+
|
|
117
139
|
return Vector3Utils
|