@quenty/r15utils 3.4.1-canary.8533eea.0 → 3.5.1

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 CHANGED
@@ -3,7 +3,15 @@
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
- ## [3.4.1-canary.8533eea.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/r15utils@3.4.0...@quenty/r15utils@3.4.1-canary.8533eea.0) (2021-12-18)
6
+ ## [3.5.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/r15utils@3.5.0...@quenty/r15utils@3.5.1) (2021-12-30)
7
+
8
+ **Note:** Version bump only for package @quenty/r15utils
9
+
10
+
11
+
12
+
13
+
14
+ # [3.5.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/r15utils@3.4.0...@quenty/r15utils@3.5.0) (2021-12-18)
7
15
 
8
16
  **Note:** Version bump only for package @quenty/r15utils
9
17
 
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  ## R15Utils
2
2
  <div align="center">
3
- <a href="http://quenty.github.io/api/">
4
- <img src="https://img.shields.io/badge/docs-website-green.svg" alt="Documentation" />
3
+ <a href="http://quenty.github.io/NevermoreEngine/">
4
+ <img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/docs.yml/badge.svg" alt="Documentation status" />
5
5
  </a>
6
6
  <a href="https://discord.gg/mhtGUS8">
7
- <img src="https://img.shields.io/badge/discord-nevermore-blue.svg" alt="Discord" />
7
+ <img src="https://img.shields.io/discord/385151591524597761?color=5865F2&label=discord&logo=discord&logoColor=white" alt="Discord" />
8
8
  </a>
9
9
  <a href="https://github.com/Quenty/NevermoreEngine/actions">
10
10
  <img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/build.yml/badge.svg" alt="Build and release status" />
@@ -13,49 +13,9 @@
13
13
 
14
14
  Utility methods for R15 Characters
15
15
 
16
+ <div align="center"><a href="https://quenty.github.io/NevermoreEngine/api/R15Utils">View docs →</a></div>
17
+
16
18
  ## Installation
17
19
  ```
18
20
  npm install @quenty/r15utils --save
19
- ```
20
-
21
- ## Usage
22
- Usage is designed to be simple.
23
-
24
- ### `R15Utils.searchForRigAttachment(character, partName, attachmentName)`
25
-
26
- ### `R15Utils.getUpperTorso(character)`
27
-
28
- ### `R15Utils.getLowerTorso(character)`
29
-
30
- ### `R15Utils.getWaistJoint(character)`
31
-
32
- ### `R15Utils.getNeckJoint(character)`
33
-
34
- ### `R15Utils.getHand(character, side)`
35
-
36
- ### `R15Utils.getGripWeld(character, side)`
37
-
38
- ### `R15Utils.getGripWeldName(side)`
39
-
40
- ### `R15Utils.getHandName(side)`
41
-
42
- ### `R15Utils.getGripAttachmentName(side)`
43
-
44
- ### `R15Utils.getShoulderRigAttachment(character, side)`
45
-
46
- ### `R15Utils.getGripAttachment(character, side)`
47
-
48
- ### `R15Utils.getExpectedRootPartYOffset(humanoid)`
49
-
50
- ### `R15Utils.getRigLength(character, partName, rigAttachment0, rigAttachment1)`
51
-
52
- ### `R15Utils.addLengthsOrNil(lengths)`
53
-
54
- ### `R15Utils.getUpperArmRigLength(character, side)`
55
-
56
- ### `R15Utils.getLowerArmRigLength(character, side)`
57
-
58
- ### `R15Utils.getWristToGripLength(character, side)`
59
-
60
- ### `R15Utils.getArmRigToGripLength(character, side)`
61
-
21
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/r15utils",
3
- "version": "3.4.1-canary.8533eea.0",
3
+ "version": "3.5.1",
4
4
  "description": "Utility methods for R15",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -25,12 +25,12 @@
25
25
  "Quenty"
26
26
  ],
27
27
  "dependencies": {
28
- "@quenty/brio": "3.4.1-canary.8533eea.0",
29
- "@quenty/instanceutils": "3.4.1-canary.8533eea.0",
30
- "@quenty/loader": "3.1.1"
28
+ "@quenty/brio": "^3.5.1",
29
+ "@quenty/instanceutils": "^3.5.1",
30
+ "@quenty/loader": "^3.1.2"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "gitHead": "8533eeade3bf6835c0295785c1c326b9abee3222"
35
+ "gitHead": "d146c77d0a8e452824de0ab0b4b03ba0370bcc1b"
36
36
  }
@@ -1,8 +1,17 @@
1
- --- Utility methods for R15 Characters
2
- -- @module R15Utils
1
+ --[=[
2
+ Utility methods for R15 Characters
3
+ @class R15Utils
4
+ ]=]
3
5
 
4
6
  local R15Utils = {}
5
7
 
8
+ --[=[
9
+ Searches the rig for an attachment
10
+ @param character Model
11
+ @param partName string
12
+ @param attachmentName string
13
+ @return Attachment?
14
+ ]=]
6
15
  function R15Utils.searchForRigAttachment(character, partName, attachmentName)
7
16
  local part = character:FindFirstChild(partName)
8
17
  if not part then
@@ -12,14 +21,29 @@ function R15Utils.searchForRigAttachment(character, partName, attachmentName)
12
21
  return part:FindFirstChild(attachmentName)
13
22
  end
14
23
 
24
+ --[=[
25
+ Retrieves the upper torso
26
+ @param character Model
27
+ @return BasePart?
28
+ ]=]
15
29
  function R15Utils.getUpperTorso(character)
16
30
  return character:FindFirstChild("UpperTorso")
17
31
  end
18
32
 
33
+ --[=[
34
+ Retrieves the lower torso
35
+ @param character Model
36
+ @return BasePart?
37
+ ]=]
19
38
  function R15Utils.getLowerTorso(character)
20
39
  return character:FindFirstChild("LowerTorso")
21
40
  end
22
41
 
42
+ --[=[
43
+ Retrieves the waist joint
44
+ @param character Model
45
+ @return Motor6D?
46
+ ]=]
23
47
  function R15Utils.getWaistJoint(character)
24
48
  local upperTorso = R15Utils.getUpperTorso(character)
25
49
  if not upperTorso then
@@ -29,6 +53,11 @@ function R15Utils.getWaistJoint(character)
29
53
  return upperTorso:FindFirstChild("Waist")
30
54
  end
31
55
 
56
+ --[=[
57
+ Retrieves the neck joint
58
+ @param character Model
59
+ @return Motor6D?
60
+ ]=]
32
61
  function R15Utils.getNeckJoint(character)
33
62
  local head = character:FindFirstChild("Head")
34
63
  if not head then
@@ -38,10 +67,22 @@ function R15Utils.getNeckJoint(character)
38
67
  return head:FindFirstChild("Neck")
39
68
  end
40
69
 
70
+ --[=[
71
+ Retrieves hand attachment
72
+ @param character Model
73
+ @param side "Left" | "Right"
74
+ @return Attachment?
75
+ ]=]
41
76
  function R15Utils.getHand(character, side)
42
77
  return character:FindFirstChild(R15Utils.getHandName(side))
43
78
  end
44
79
 
80
+ --[=[
81
+ Retrieves grip weld
82
+ @param character Model
83
+ @param side "Left" | "Right"
84
+ @return Motor6D?
85
+ ]=]
45
86
  function R15Utils.getGripWeld(character, side)
46
87
  local rightHand = R15Utils.getHand(character, side)
47
88
  if rightHand then
@@ -51,6 +92,11 @@ function R15Utils.getGripWeld(character, side)
51
92
  end
52
93
  end
53
94
 
95
+ --[=[
96
+ Retrieves grip weld name for a given side
97
+ @param side "Left" | "Right"
98
+ @return "LeftGrip" | "RightGrip"
99
+ ]=]
54
100
  function R15Utils.getGripWeldName(side)
55
101
  if side == "Left" then
56
102
  return "LeftGrip"
@@ -61,6 +107,11 @@ function R15Utils.getGripWeldName(side)
61
107
  end
62
108
  end
63
109
 
110
+ --[=[
111
+ Retrieves grip weld name for a given side
112
+ @param side "Left" | "Right"
113
+ @return "LeftHand" | "RightHand"
114
+ ]=]
64
115
  function R15Utils.getHandName(side)
65
116
  if side == "Left" then
66
117
  return "LeftHand"
@@ -71,6 +122,11 @@ function R15Utils.getHandName(side)
71
122
  end
72
123
  end
73
124
 
125
+ --[=[
126
+ Retrieves the grip attachment name
127
+ @param side "Left" | "Right"
128
+ @return "LeftGripAttachment" | "RightGripAttachment"
129
+ ]=]
74
130
  function R15Utils.getGripAttachmentName(side)
75
131
  if side == "Left" then
76
132
  return "LeftGripAttachment"
@@ -81,6 +137,12 @@ function R15Utils.getGripAttachmentName(side)
81
137
  end
82
138
  end
83
139
 
140
+ --[=[
141
+ Retrieves the shoulder rig attachment
142
+ @param character Model
143
+ @param side "Left" | "Right"
144
+ @return Attachment?
145
+ ]=]
84
146
  function R15Utils.getShoulderRigAttachment(character, side)
85
147
  if side == "Left" then
86
148
  return R15Utils.searchForRigAttachment(character, "UpperTorso", "LeftShoulderRigAttachment")
@@ -91,6 +153,12 @@ function R15Utils.getShoulderRigAttachment(character, side)
91
153
  end
92
154
  end
93
155
 
156
+ --[=[
157
+ Retrieves the grip attachment for the given side
158
+ @param character Model
159
+ @param side "Left" | "Right"
160
+ @return Attachment?
161
+ ]=]
94
162
  function R15Utils.getGripAttachment(character, side)
95
163
  if side == "Left" then
96
164
  return R15Utils.searchForRigAttachment(character, "LeftHand", "LeftGripAttachment")
@@ -101,6 +169,11 @@ function R15Utils.getGripAttachment(character, side)
101
169
  end
102
170
  end
103
171
 
172
+ --[=[
173
+ Retrieves the expected root part y offset for a humanoid
174
+ @param humanoid Humanoid
175
+ @return number?
176
+ ]=]
104
177
  function R15Utils.getExpectedRootPartYOffset(humanoid)
105
178
  local rootPart = humanoid.RootPart
106
179
  if not rootPart then
@@ -110,6 +183,14 @@ function R15Utils.getExpectedRootPartYOffset(humanoid)
110
183
  return humanoid.HipHeight + rootPart.Size.Y/2
111
184
  end
112
185
 
186
+ --[=[
187
+ Gets the length of a segment for a rig
188
+ @param character Model
189
+ @param partName string
190
+ @param rigAttachment0 string
191
+ @param rigAttachment1 string
192
+ @return number?
193
+ ]=]
113
194
  function R15Utils.getRigLength(character, partName, rigAttachment0, rigAttachment1)
114
195
  local attachment0 = R15Utils.searchForRigAttachment(character, partName, rigAttachment0)
115
196
  if not attachment0 then
@@ -124,6 +205,11 @@ function R15Utils.getRigLength(character, partName, rigAttachment0, rigAttachmen
124
205
  return (attachment0.Position - attachment1.Position).magnitude
125
206
  end
126
207
 
208
+ --[=[
209
+ Adds the lengths together
210
+ @param lengths { number? }
211
+ @return number?
212
+ ]=]
127
213
  function R15Utils.addLengthsOrNil(lengths)
128
214
  local total = 0
129
215
  for _, length in pairs(lengths) do
@@ -137,6 +223,12 @@ function R15Utils.addLengthsOrNil(lengths)
137
223
  return total
138
224
  end
139
225
 
226
+ --[=[
227
+ Retrieves the upper arm length for a character
228
+ @param character Model
229
+ @param side "Left" | "Right"
230
+ @return number?
231
+ ]=]
140
232
  function R15Utils.getUpperArmRigLength(character, side)
141
233
  if side == "Left" then
142
234
  return R15Utils.getRigLength(character, "LeftUpperArm", "LeftShoulderRigAttachment", "LeftElbowRigAttachment")
@@ -147,6 +239,12 @@ function R15Utils.getUpperArmRigLength(character, side)
147
239
  end
148
240
  end
149
241
 
242
+ --[=[
243
+ Retrieves the lower arm length for a character
244
+ @param character Model
245
+ @param side "Left" | "Right"
246
+ @return number?
247
+ ]=]
150
248
  function R15Utils.getLowerArmRigLength(character, side)
151
249
  if side == "Left" then
152
250
  return R15Utils.getRigLength(character, "LeftLowerArm", "LeftElbowRigAttachment", "LeftWristRigAttachment")
@@ -157,6 +255,12 @@ function R15Utils.getLowerArmRigLength(character, side)
157
255
  end
158
256
  end
159
257
 
258
+ --[=[
259
+ Retrieves the wrist to hand length
260
+ @param character Model
261
+ @param side "Left" | "Right"
262
+ @return number?
263
+ ]=]
160
264
  function R15Utils.getWristToGripLength(character, side)
161
265
  if side == "Left" then
162
266
  return R15Utils.getRigLength(character, "LeftHand", "LeftWristRigAttachment", "LeftGripAttachment")
@@ -167,6 +271,12 @@ function R15Utils.getWristToGripLength(character, side)
167
271
  end
168
272
  end
169
273
 
274
+ --[=[
275
+ Computes the length of an arm for a given character
276
+ @param character Model
277
+ @param side "Left" | "Right"
278
+ @return number?
279
+ ]=]
170
280
  function R15Utils.getArmRigToGripLength(character, side)
171
281
  return R15Utils.addLengthsOrNil({
172
282
  R15Utils.getUpperArmRigLength(character, side),
@@ -1,6 +1,6 @@
1
- ---
2
- -- @module RxR15Utils
3
- -- @author Quenty
1
+ --[=[
2
+ @class RxR15Utils
3
+ ]=]
4
4
 
5
5
  local require = require(script.Parent.loader).load(script)
6
6