@quenty/rigbuilderutils 10.19.0 → 10.19.1-canary.545.2374fb2.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 +11 -0
- package/package.json +9 -9
- package/src/Shared/RigBuilderUtils.lua +149 -138
- package/src/Shared/RigBuilderUtils.story.lua +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
## [10.19.1-canary.545.2374fb2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/rigbuilderutils@10.19.0...@quenty/rigbuilderutils@10.19.1-canary.545.2374fb2.0) (2025-04-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [10.19.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/rigbuilderutils@10.18.2...@quenty/rigbuilderutils@10.19.0) (2025-04-02)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @quenty/rigbuilderutils
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/rigbuilderutils",
|
|
3
|
-
"version": "10.19.0",
|
|
3
|
+
"version": "10.19.1-canary.545.2374fb2.0",
|
|
4
4
|
"description": "Utility functions for debugging, builds a Roblox character rig",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -26,18 +26,18 @@
|
|
|
26
26
|
"Quenty"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@quenty/assetserviceutils": "
|
|
30
|
-
"@quenty/humanoiddescriptionutils": "
|
|
31
|
-
"@quenty/insertserviceutils": "
|
|
32
|
-
"@quenty/loader": "
|
|
33
|
-
"@quenty/promise": "
|
|
29
|
+
"@quenty/assetserviceutils": "5.19.1-canary.545.2374fb2.0",
|
|
30
|
+
"@quenty/humanoiddescriptionutils": "10.10.2-canary.545.2374fb2.0",
|
|
31
|
+
"@quenty/insertserviceutils": "10.10.2-canary.545.2374fb2.0",
|
|
32
|
+
"@quenty/loader": "10.8.1-canary.545.2374fb2.0",
|
|
33
|
+
"@quenty/promise": "10.10.2-canary.545.2374fb2.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@quenty/camerastoryutils": "
|
|
37
|
-
"@quenty/maid": "
|
|
36
|
+
"@quenty/camerastoryutils": "10.10.2-canary.545.2374fb2.0",
|
|
37
|
+
"@quenty/maid": "3.4.1-canary.545.2374fb2.0"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "2374fb2b043cfbe0e9b507b3316eec46a4e353a0"
|
|
43
43
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
--!strict
|
|
1
2
|
--[=[
|
|
2
3
|
Helps build player characters or other humanoid rigs for use in a variety of situations.
|
|
3
4
|
@class RigBuilderUtils
|
|
@@ -15,17 +16,17 @@ local HumanoidDescriptionUtils = require("HumanoidDescriptionUtils")
|
|
|
15
16
|
|
|
16
17
|
local RigBuilderUtils = {}
|
|
17
18
|
|
|
18
|
-
local function jointBetween(a, b, cfa, cfb)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
local function jointBetween(a: BasePart, b: BasePart, cfa: CFrame, cfb: CFrame): Motor6D
|
|
20
|
+
local weld = Instance.new("Motor6D")
|
|
21
|
+
weld.Part0 = a
|
|
22
|
+
weld.Part1 = b
|
|
23
|
+
weld.C0 = cfa
|
|
24
|
+
weld.C1 = cfb
|
|
25
|
+
weld.Parent = a
|
|
26
|
+
return weld
|
|
26
27
|
end
|
|
27
28
|
|
|
28
|
-
local function addAttachment(part, name, position
|
|
29
|
+
local function addAttachment(part: BasePart, name: string, position: Vector3?, orientation: Vector3?): Attachment
|
|
29
30
|
local attachment = Instance.new("Attachment")
|
|
30
31
|
attachment.Name = name
|
|
31
32
|
attachment.Parent = part
|
|
@@ -46,7 +47,7 @@ end
|
|
|
46
47
|
function RigBuilderUtils.disableAnimateScript(rig: Model)
|
|
47
48
|
local animate = RigBuilderUtils.findAnimateScript(rig)
|
|
48
49
|
if animate then
|
|
49
|
-
animate.Enabled = false
|
|
50
|
+
(animate :: any).Enabled = false
|
|
50
51
|
end
|
|
51
52
|
end
|
|
52
53
|
|
|
@@ -56,16 +57,16 @@ end
|
|
|
56
57
|
@param rig Model
|
|
57
58
|
@return LocalScript?
|
|
58
59
|
]=]
|
|
59
|
-
function RigBuilderUtils.findAnimateScript(rig: Model)
|
|
60
|
+
function RigBuilderUtils.findAnimateScript(rig: Model): (Script | LocalScript)?
|
|
60
61
|
local animate = rig:FindFirstChild("Animate")
|
|
61
62
|
if animate and (animate:IsA("LocalScript") or animate:IsA("Script")) then
|
|
62
|
-
return animate
|
|
63
|
+
return animate :: any
|
|
63
64
|
end
|
|
64
65
|
|
|
65
66
|
return nil
|
|
66
67
|
end
|
|
67
68
|
|
|
68
|
-
function RigBuilderUtils.createR6BaseRig()
|
|
69
|
+
function RigBuilderUtils.createR6BaseRig(): Model
|
|
69
70
|
local character = Instance.new("Model")
|
|
70
71
|
character.Name = "Dummy"
|
|
71
72
|
|
|
@@ -76,8 +77,8 @@ function RigBuilderUtils.createR6BaseRig()
|
|
|
76
77
|
root.Transparency = 1
|
|
77
78
|
root.Size = Vector3.new(2, 2, 1)
|
|
78
79
|
root.CFrame = CFrame.new(0, 5.2, 4.5)
|
|
79
|
-
root.BottomSurface =
|
|
80
|
-
root.TopSurface =
|
|
80
|
+
root.BottomSurface = Enum.SurfaceType.Smooth
|
|
81
|
+
root.TopSurface = Enum.SurfaceType.Smooth
|
|
81
82
|
root.Parent = character
|
|
82
83
|
character.PrimaryPart = root
|
|
83
84
|
|
|
@@ -87,95 +88,88 @@ function RigBuilderUtils.createR6BaseRig()
|
|
|
87
88
|
torso.CanCollide = false
|
|
88
89
|
torso.Size = Vector3.new(2, 2, 1)
|
|
89
90
|
torso.CFrame = CFrame.new(0, 5.2, 4.5)
|
|
90
|
-
torso.BottomSurface =
|
|
91
|
-
torso.TopSurface =
|
|
91
|
+
torso.BottomSurface = Enum.SurfaceType.Smooth
|
|
92
|
+
torso.TopSurface = Enum.SurfaceType.Smooth
|
|
92
93
|
torso.Parent = character
|
|
93
94
|
|
|
94
|
-
local RCA = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0
|
|
95
|
+
local RCA = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
|
|
95
96
|
local RCB = RCA
|
|
96
97
|
local rootHip = jointBetween(root, torso, RCA, RCB)
|
|
97
98
|
rootHip.Name = "Root Hip"
|
|
98
99
|
rootHip.MaxVelocity = 0.1
|
|
99
100
|
|
|
100
|
-
|
|
101
101
|
local leftLeg = Instance.new("Part")
|
|
102
102
|
leftLeg.Name = "Left Leg"
|
|
103
103
|
leftLeg.Anchored = false
|
|
104
104
|
leftLeg.CanCollide = false
|
|
105
105
|
leftLeg.Size = Vector3.new(1, 2, 1)
|
|
106
106
|
leftLeg.CFrame = CFrame.new(0.5, 3.2, 4.5)
|
|
107
|
-
leftLeg.BottomSurface =
|
|
108
|
-
leftLeg.TopSurface =
|
|
107
|
+
leftLeg.BottomSurface = Enum.SurfaceType.Smooth
|
|
108
|
+
leftLeg.TopSurface = Enum.SurfaceType.Smooth
|
|
109
109
|
leftLeg.Parent = character
|
|
110
110
|
|
|
111
|
-
local LHCA = CFrame.new(-1, -1, 0) * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), -math.pi/2)
|
|
112
|
-
local LHCB = CFrame.new(-0.5, 1, 0) * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), -math.pi/2)
|
|
111
|
+
local LHCA = CFrame.new(-1, -1, 0) * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), -math.pi / 2)
|
|
112
|
+
local LHCB = CFrame.new(-0.5, 1, 0) * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), -math.pi / 2)
|
|
113
113
|
local leftHip = jointBetween(torso, leftLeg, LHCA, LHCB)
|
|
114
114
|
leftHip.Name = "Left Hip"
|
|
115
115
|
leftHip.MaxVelocity = 0.1
|
|
116
116
|
|
|
117
|
-
|
|
118
117
|
local rightLeg = Instance.new("Part")
|
|
119
118
|
rightLeg.Name = "Right Leg"
|
|
120
119
|
rightLeg.Anchored = false
|
|
121
120
|
rightLeg.CanCollide = false
|
|
122
121
|
rightLeg.Size = Vector3.new(1, 2, 1)
|
|
123
122
|
rightLeg.CFrame = CFrame.new(-0.5, 3.2, 4.5)
|
|
124
|
-
rightLeg.BottomSurface =
|
|
125
|
-
rightLeg.TopSurface =
|
|
123
|
+
rightLeg.BottomSurface = Enum.SurfaceType.Smooth
|
|
124
|
+
rightLeg.TopSurface = Enum.SurfaceType.Smooth
|
|
126
125
|
rightLeg.Parent = character
|
|
127
126
|
|
|
128
|
-
|
|
129
|
-
local
|
|
130
|
-
local RHCB = CFrame.new(0.5, 1, 0) * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), math.pi/2)
|
|
127
|
+
local RHCA = CFrame.new(1, -1, 0) * CFrame.fromAxisAngle(Vector3.new(0, -1, 0), -math.pi / 2)
|
|
128
|
+
local RHCB = CFrame.new(0.5, 1, 0) * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), math.pi / 2)
|
|
131
129
|
local rightHip = jointBetween(torso, rightLeg, RHCA, RHCB)
|
|
132
130
|
rightHip.Name = "Right Hip"
|
|
133
131
|
rightHip.MaxVelocity = 0.1
|
|
134
132
|
|
|
135
|
-
|
|
136
133
|
local leftArm = Instance.new("Part")
|
|
137
134
|
leftArm.Name = "Left Arm"
|
|
138
135
|
leftArm.Anchored = false
|
|
139
136
|
leftArm.CanCollide = false
|
|
140
137
|
leftArm.Size = Vector3.new(1, 2, 1)
|
|
141
138
|
leftArm.CFrame = CFrame.new(1.5, 5.2, 4.5)
|
|
142
|
-
leftArm.BottomSurface =
|
|
143
|
-
leftArm.TopSurface =
|
|
139
|
+
leftArm.BottomSurface = Enum.SurfaceType.Smooth
|
|
140
|
+
leftArm.TopSurface = Enum.SurfaceType.Smooth
|
|
144
141
|
leftArm.Parent = character
|
|
145
142
|
|
|
146
|
-
|
|
147
|
-
local
|
|
148
|
-
local LSCB = CFrame.new(0.5, 0.5, 0) * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), -math.pi/2)
|
|
143
|
+
local LSCA = CFrame.new(-1.0, 0.5, 0) * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), -math.pi / 2)
|
|
144
|
+
local LSCB = CFrame.new(0.5, 0.5, 0) * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), -math.pi / 2)
|
|
149
145
|
local leftShoulder = jointBetween(torso, leftArm, LSCA, LSCB)
|
|
150
146
|
leftShoulder.Name = "Left Shoulder"
|
|
151
147
|
leftShoulder.MaxVelocity = 0.1
|
|
152
148
|
|
|
153
|
-
|
|
154
149
|
local rightArm = Instance.new("Part")
|
|
155
150
|
rightArm.Name = "Right Arm"
|
|
156
151
|
rightArm.Anchored = false
|
|
157
152
|
rightArm.CanCollide = false
|
|
158
153
|
rightArm.Size = Vector3.new(1, 2, 1)
|
|
159
154
|
rightArm.CFrame = CFrame.new(-1.5, 5.2, 4.5)
|
|
160
|
-
rightArm.BottomSurface =
|
|
161
|
-
rightArm.TopSurface =
|
|
155
|
+
rightArm.BottomSurface = Enum.SurfaceType.Smooth
|
|
156
|
+
rightArm.TopSurface = Enum.SurfaceType.Smooth
|
|
162
157
|
rightArm.Parent = character
|
|
163
158
|
|
|
164
|
-
local RSCA = CFrame.new(1.0, 0.5, 0) * CFrame.fromAxisAngle(Vector3.new(0, -1, 0), -math.pi/2)
|
|
165
|
-
local RSCB = CFrame.new(-0.5, 0.5, 0) * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), math.pi/2)
|
|
159
|
+
local RSCA = CFrame.new(1.0, 0.5, 0) * CFrame.fromAxisAngle(Vector3.new(0, -1, 0), -math.pi / 2)
|
|
160
|
+
local RSCB = CFrame.new(-0.5, 0.5, 0) * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), math.pi / 2)
|
|
166
161
|
local rightShoulder = jointBetween(torso, rightArm, RSCA, RSCB)
|
|
167
162
|
rightShoulder.Name = "Right Shoulder"
|
|
168
163
|
rightShoulder.MaxVelocity = 0.1
|
|
169
164
|
|
|
170
|
-
|
|
171
165
|
local head = Instance.new("Part")
|
|
172
166
|
head.Name = "Head"
|
|
173
167
|
head.Anchored = false
|
|
174
168
|
head.CanCollide = true
|
|
175
169
|
head.Size = Vector3.new(2, 1, 1)
|
|
176
170
|
head.CFrame = CFrame.new(0, 6.7, 4.5)
|
|
177
|
-
head.BottomSurface =
|
|
178
|
-
head.TopSurface =
|
|
171
|
+
head.BottomSurface = Enum.SurfaceType.Smooth
|
|
172
|
+
head.TopSurface = Enum.SurfaceType.Smooth
|
|
179
173
|
head.Parent = character
|
|
180
174
|
|
|
181
175
|
local NCA = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
|
|
@@ -197,125 +191,125 @@ end
|
|
|
197
191
|
|
|
198
192
|
--[=[
|
|
199
193
|
Creates an R6 mesh rig
|
|
200
|
-
@return
|
|
194
|
+
@return Model
|
|
201
195
|
]=]
|
|
202
|
-
function RigBuilderUtils.createR6MeshRig()
|
|
196
|
+
function RigBuilderUtils.createR6MeshRig(): Model
|
|
203
197
|
local rig = RigBuilderUtils.createR6BaseRig()
|
|
204
198
|
|
|
205
199
|
local lArmMesh = Instance.new("CharacterMesh")
|
|
206
200
|
lArmMesh.MeshId = 27111419
|
|
207
|
-
lArmMesh.BodyPart =
|
|
201
|
+
lArmMesh.BodyPart = Enum.BodyPart.LeftArm
|
|
208
202
|
lArmMesh.Parent = rig
|
|
209
203
|
|
|
210
204
|
local rArmMesh = Instance.new("CharacterMesh")
|
|
211
205
|
rArmMesh.MeshId = 27111864
|
|
212
|
-
rArmMesh.BodyPart =
|
|
206
|
+
rArmMesh.BodyPart = Enum.BodyPart.RightArm
|
|
213
207
|
rArmMesh.Parent = rig
|
|
214
208
|
|
|
215
209
|
local lLegMesh = Instance.new("CharacterMesh")
|
|
216
210
|
lLegMesh.MeshId = 27111857
|
|
217
|
-
lLegMesh.BodyPart =
|
|
211
|
+
lLegMesh.BodyPart = Enum.BodyPart.LeftLeg
|
|
218
212
|
lLegMesh.Parent = rig
|
|
219
213
|
|
|
220
214
|
local rLegMesh = Instance.new("CharacterMesh")
|
|
221
215
|
rLegMesh.MeshId = 27111882
|
|
222
|
-
rLegMesh.BodyPart =
|
|
216
|
+
rLegMesh.BodyPart = Enum.BodyPart.RightLeg
|
|
223
217
|
rLegMesh.Parent = rig
|
|
224
218
|
|
|
225
219
|
local torsoMesh = Instance.new("CharacterMesh")
|
|
226
220
|
torsoMesh.MeshId = 27111894
|
|
227
|
-
torsoMesh.BodyPart =
|
|
221
|
+
torsoMesh.BodyPart = Enum.BodyPart.Torso
|
|
228
222
|
torsoMesh.Parent = rig
|
|
229
223
|
|
|
230
224
|
local headMesh = Instance.new("SpecialMesh")
|
|
231
|
-
headMesh.MeshType =
|
|
225
|
+
headMesh.MeshType = Enum.MeshType.Head
|
|
232
226
|
headMesh.Scale = Vector3.new(1.25, 1.25, 1.25)
|
|
233
|
-
headMesh.Parent = rig.Head
|
|
227
|
+
headMesh.Parent = (rig :: any).Head
|
|
234
228
|
|
|
235
229
|
return rig
|
|
236
230
|
end
|
|
237
231
|
|
|
238
232
|
--[=[
|
|
239
233
|
Creates an R6 boy mesh rig
|
|
240
|
-
@return
|
|
234
|
+
@return Model
|
|
241
235
|
]=]
|
|
242
|
-
function RigBuilderUtils.createR6MeshBoyRig()
|
|
236
|
+
function RigBuilderUtils.createR6MeshBoyRig(): Model
|
|
243
237
|
local rig = RigBuilderUtils.createR6BaseRig()
|
|
244
238
|
|
|
245
239
|
local lArmMesh = Instance.new("CharacterMesh")
|
|
246
240
|
lArmMesh.MeshId = 82907977
|
|
247
|
-
lArmMesh.BodyPart =
|
|
241
|
+
lArmMesh.BodyPart = Enum.BodyPart.LeftArm
|
|
248
242
|
lArmMesh.Parent = rig
|
|
249
243
|
|
|
250
244
|
local rArmMesh = Instance.new("CharacterMesh")
|
|
251
245
|
rArmMesh.MeshId = 82908019
|
|
252
|
-
rArmMesh.BodyPart =
|
|
246
|
+
rArmMesh.BodyPart = Enum.BodyPart.RightArm
|
|
253
247
|
rArmMesh.Parent = rig
|
|
254
248
|
|
|
255
249
|
local lLegMesh = Instance.new("CharacterMesh")
|
|
256
250
|
lLegMesh.MeshId = 81487640
|
|
257
|
-
lLegMesh.BodyPart =
|
|
251
|
+
lLegMesh.BodyPart = Enum.BodyPart.LeftLeg
|
|
258
252
|
lLegMesh.Parent = rig
|
|
259
253
|
|
|
260
254
|
local rLegMesh = Instance.new("CharacterMesh")
|
|
261
255
|
rLegMesh.MeshId = 81487710
|
|
262
|
-
rLegMesh.BodyPart =
|
|
256
|
+
rLegMesh.BodyPart = Enum.BodyPart.RightLeg
|
|
263
257
|
rLegMesh.Parent = rig
|
|
264
258
|
|
|
265
259
|
local torsoMesh = Instance.new("CharacterMesh")
|
|
266
260
|
torsoMesh.MeshId = 82907945
|
|
267
|
-
torsoMesh.BodyPart =
|
|
261
|
+
torsoMesh.BodyPart = Enum.BodyPart.Torso
|
|
268
262
|
torsoMesh.Parent = rig
|
|
269
263
|
|
|
270
264
|
local headMesh = Instance.new("SpecialMesh")
|
|
271
|
-
headMesh.MeshType =
|
|
265
|
+
headMesh.MeshType = Enum.MeshType.Head
|
|
272
266
|
headMesh.Scale = Vector3.new(1.25, 1.25, 1.25)
|
|
273
|
-
headMesh.Parent = rig.Head
|
|
267
|
+
headMesh.Parent = (rig :: any).Head
|
|
274
268
|
|
|
275
269
|
return rig
|
|
276
270
|
end
|
|
277
271
|
|
|
278
272
|
--[=[
|
|
279
273
|
Creates an R6 girl mesh rig
|
|
280
|
-
@return
|
|
274
|
+
@return Model
|
|
281
275
|
]=]
|
|
282
|
-
function RigBuilderUtils.createR6MeshGirlRig()
|
|
276
|
+
function RigBuilderUtils.createR6MeshGirlRig(): Model
|
|
283
277
|
local rig = RigBuilderUtils.createR6BaseRig()
|
|
284
278
|
|
|
285
279
|
local lArmMesh = Instance.new("CharacterMesh")
|
|
286
280
|
lArmMesh.MeshId = 83001137
|
|
287
|
-
lArmMesh.BodyPart =
|
|
281
|
+
lArmMesh.BodyPart = Enum.BodyPart.LeftArm
|
|
288
282
|
lArmMesh.Parent = rig
|
|
289
283
|
|
|
290
284
|
local rArmMesh = Instance.new("CharacterMesh")
|
|
291
285
|
rArmMesh.MeshId = 83001181
|
|
292
|
-
rArmMesh.BodyPart =
|
|
286
|
+
rArmMesh.BodyPart = Enum.BodyPart.RightArm
|
|
293
287
|
rArmMesh.Parent = rig
|
|
294
288
|
|
|
295
289
|
local lLegMesh = Instance.new("CharacterMesh")
|
|
296
290
|
lLegMesh.MeshId = 81628361
|
|
297
|
-
lLegMesh.BodyPart =
|
|
291
|
+
lLegMesh.BodyPart = Enum.BodyPart.LeftLeg
|
|
298
292
|
lLegMesh.Parent = rig
|
|
299
293
|
|
|
300
294
|
local rLegMesh = Instance.new("CharacterMesh")
|
|
301
295
|
rLegMesh.MeshId = 81628308
|
|
302
|
-
rLegMesh.BodyPart =
|
|
296
|
+
rLegMesh.BodyPart = Enum.BodyPart.RightLeg
|
|
303
297
|
rLegMesh.Parent = rig
|
|
304
298
|
|
|
305
299
|
local torsoMesh = Instance.new("CharacterMesh")
|
|
306
300
|
torsoMesh.MeshId = 82987757
|
|
307
|
-
torsoMesh.BodyPart =
|
|
301
|
+
torsoMesh.BodyPart = Enum.BodyPart.Torso
|
|
308
302
|
torsoMesh.Parent = rig
|
|
309
303
|
|
|
310
304
|
local headMesh = Instance.new("SpecialMesh")
|
|
311
|
-
headMesh.MeshType =
|
|
305
|
+
headMesh.MeshType = Enum.MeshType.Head
|
|
312
306
|
headMesh.Scale = Vector3.new(1.25, 1.25, 1.25)
|
|
313
|
-
headMesh.Parent = rig.Head
|
|
307
|
+
headMesh.Parent = (rig :: any).Head
|
|
314
308
|
|
|
315
309
|
return rig
|
|
316
310
|
end
|
|
317
311
|
|
|
318
|
-
function RigBuilderUtils._createR15BaseRig()
|
|
312
|
+
function RigBuilderUtils._createR15BaseRig(): (Model, Humanoid)
|
|
319
313
|
local character = Instance.new("Model")
|
|
320
314
|
character.Name = "Dummy"
|
|
321
315
|
|
|
@@ -325,18 +319,18 @@ function RigBuilderUtils._createR15BaseRig()
|
|
|
325
319
|
|
|
326
320
|
local rootPart = Instance.new("Part")
|
|
327
321
|
rootPart.Name = "HumanoidRootPart"
|
|
328
|
-
rootPart.Size = Vector3.new(2,2,1)
|
|
322
|
+
rootPart.Size = Vector3.new(2, 2, 1)
|
|
329
323
|
rootPart.Transparency = 1
|
|
330
324
|
rootPart.Parent = character
|
|
331
|
-
addAttachment(rootPart,"RootRigAttachment")
|
|
325
|
+
addAttachment(rootPart, "RootRigAttachment")
|
|
332
326
|
|
|
333
327
|
local head = Instance.new("Part")
|
|
334
328
|
head.Name = "Head"
|
|
335
|
-
head.Size = Vector3.new(2,1,1)
|
|
329
|
+
head.Size = Vector3.new(2, 1, 1)
|
|
336
330
|
head.Parent = character
|
|
337
331
|
|
|
338
332
|
local headMesh = Instance.new("SpecialMesh")
|
|
339
|
-
headMesh.Scale = Vector3.new(1.25,1.25,1.25)
|
|
333
|
+
headMesh.Scale = Vector3.new(1.25, 1.25, 1.25)
|
|
340
334
|
headMesh.MeshType = Enum.MeshType.Head
|
|
341
335
|
headMesh.Parent = head
|
|
342
336
|
|
|
@@ -346,10 +340,10 @@ function RigBuilderUtils._createR15BaseRig()
|
|
|
346
340
|
face.Parent = head
|
|
347
341
|
|
|
348
342
|
addAttachment(head, "FaceCenterAttachment")
|
|
349
|
-
addAttachment(head, "FaceFrontAttachment", Vector3.new(0,0
|
|
350
|
-
addAttachment(head, "HairAttachment", Vector3.new(0,0.6,0))
|
|
351
|
-
addAttachment(head, "HatAttachment", Vector3.new(0,0.6,0))
|
|
352
|
-
addAttachment(head, "NeckRigAttachment", Vector3.new(0
|
|
343
|
+
addAttachment(head, "FaceFrontAttachment", Vector3.new(0, 0, -0.6))
|
|
344
|
+
addAttachment(head, "HairAttachment", Vector3.new(0, 0.6, 0))
|
|
345
|
+
addAttachment(head, "HatAttachment", Vector3.new(0, 0.6, 0))
|
|
346
|
+
addAttachment(head, "NeckRigAttachment", Vector3.new(0, -0.5, 0))
|
|
353
347
|
|
|
354
348
|
character.PrimaryPart = rootPart
|
|
355
349
|
|
|
@@ -361,31 +355,32 @@ end
|
|
|
361
355
|
@param packageAssetId number
|
|
362
356
|
@return Promise<Instance>
|
|
363
357
|
]=]
|
|
364
|
-
function RigBuilderUtils.promiseR15PackageRig(packageAssetId)
|
|
358
|
+
function RigBuilderUtils.promiseR15PackageRig(packageAssetId: number): Promise.Promise<Model>
|
|
365
359
|
assert(type(packageAssetId) == "number", "Bad packageAssetId")
|
|
366
360
|
|
|
367
361
|
return AssetServiceUtils.promiseAssetIdsForPackage(packageAssetId)
|
|
368
362
|
:Then(function(assetIds)
|
|
369
363
|
local promises = {}
|
|
370
|
-
for _, assetId in
|
|
364
|
+
for _, assetId in assetIds do
|
|
371
365
|
table.insert(promises, InsertServiceUtils.promiseAsset(assetId))
|
|
372
366
|
end
|
|
373
367
|
return PromiseUtils.all(promises)
|
|
374
368
|
end)
|
|
375
369
|
:Then(function(...)
|
|
376
|
-
local limbs = {...}
|
|
370
|
+
local limbs = { ... }
|
|
377
371
|
local character, humanoid = RigBuilderUtils._createR15BaseRig()
|
|
372
|
+
local head = (character :: any).Head
|
|
378
373
|
|
|
379
374
|
local face = nil
|
|
380
375
|
local headMesh = nil
|
|
381
376
|
|
|
382
|
-
for _, limb in
|
|
377
|
+
for _, limb in limbs do
|
|
383
378
|
if limb:FindFirstChild("R15ArtistIntent") then
|
|
384
|
-
for _, x in
|
|
379
|
+
for _, x in limb.R15ArtistIntent:GetChildren() do
|
|
385
380
|
x.Parent = character
|
|
386
381
|
end
|
|
387
382
|
elseif limb:FindFirstChild("R15") then
|
|
388
|
-
for _, x in
|
|
383
|
+
for _, x in limb.R15:GetChildren() do
|
|
389
384
|
x.Parent = character
|
|
390
385
|
end
|
|
391
386
|
elseif limb:FindFirstChild("face") then
|
|
@@ -398,17 +393,17 @@ function RigBuilderUtils.promiseR15PackageRig(packageAssetId)
|
|
|
398
393
|
end
|
|
399
394
|
|
|
400
395
|
if headMesh then
|
|
401
|
-
|
|
402
|
-
headMesh.Parent =
|
|
396
|
+
head.Mesh:Destroy()
|
|
397
|
+
headMesh.Parent = head
|
|
403
398
|
end
|
|
404
399
|
|
|
405
400
|
if face then
|
|
406
|
-
for _, v in
|
|
401
|
+
for _, v in head:GetChildren() do
|
|
407
402
|
if v.Name == "face" or v.Name == "Face" then
|
|
408
403
|
v:Destroy()
|
|
409
404
|
end
|
|
410
405
|
end
|
|
411
|
-
face.Parent =
|
|
406
|
+
face.Parent = head
|
|
412
407
|
end
|
|
413
408
|
|
|
414
409
|
humanoid:BuildRigFromAttachments()
|
|
@@ -422,37 +417,36 @@ end
|
|
|
422
417
|
@return Promise<Instance>
|
|
423
418
|
]=]
|
|
424
419
|
function RigBuilderUtils.promiseR15Rig()
|
|
425
|
-
return InsertServiceUtils.promiseAsset(1664543044)
|
|
426
|
-
:
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
end
|
|
420
|
+
return InsertServiceUtils.promiseAsset(1664543044):Then(function(inserted)
|
|
421
|
+
local character = inserted:GetChildren()[1]
|
|
422
|
+
if not character then
|
|
423
|
+
return Promise.rejected("No character from model")
|
|
424
|
+
end
|
|
431
425
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
426
|
+
local humanoid = character:FindFirstChildOfClass("Humanoid")
|
|
427
|
+
if humanoid then
|
|
428
|
+
humanoid:BuildRigFromAttachments()
|
|
429
|
+
end
|
|
436
430
|
|
|
437
|
-
|
|
431
|
+
local r15Head = character:FindFirstChild("Head")
|
|
438
432
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
433
|
+
local existingFace = r15Head:FindFirstChild("face") or r15Head:FindFirstChild("Face")
|
|
434
|
+
if existingFace == nil then
|
|
435
|
+
local face = Instance.new("Decal")
|
|
436
|
+
face.Name = "face"
|
|
437
|
+
face.Texture = "rbxasset://textures/face.png"
|
|
438
|
+
face.Parent = r15Head
|
|
439
|
+
end
|
|
446
440
|
|
|
447
|
-
|
|
448
|
-
|
|
441
|
+
return character
|
|
442
|
+
end)
|
|
449
443
|
end
|
|
450
444
|
|
|
451
445
|
--[=[
|
|
452
446
|
Creates an R15 man rig
|
|
453
447
|
@return Promise<Instance>
|
|
454
448
|
]=]
|
|
455
|
-
function RigBuilderUtils.promiseR15ManRig()
|
|
449
|
+
function RigBuilderUtils.promiseR15ManRig(): Promise.Promise<Model>
|
|
456
450
|
return RigBuilderUtils.promiseR15PackageRig(86500185)
|
|
457
451
|
end
|
|
458
452
|
|
|
@@ -460,7 +454,7 @@ end
|
|
|
460
454
|
Creates an R15 woman rig
|
|
461
455
|
@return Promise<Instance>
|
|
462
456
|
]=]
|
|
463
|
-
function RigBuilderUtils.promiseR15WomanRig()
|
|
457
|
+
function RigBuilderUtils.promiseR15WomanRig(): Promise.Promise<Model>
|
|
464
458
|
return RigBuilderUtils.promiseR15PackageRig(86499905)
|
|
465
459
|
end
|
|
466
460
|
|
|
@@ -468,7 +462,7 @@ end
|
|
|
468
462
|
Creates an R15 mesh rig
|
|
469
463
|
@return Promise<Instance>
|
|
470
464
|
]=]
|
|
471
|
-
function RigBuilderUtils.promiseR15MeshRig()
|
|
465
|
+
function RigBuilderUtils.promiseR15MeshRig(): Promise.Promise<Model>
|
|
472
466
|
return RigBuilderUtils.promiseR15PackageRig(27112438)
|
|
473
467
|
end
|
|
474
468
|
|
|
@@ -479,33 +473,44 @@ end
|
|
|
479
473
|
@param assetTypeVerification AssetTypeVerification | nil
|
|
480
474
|
@return Promise<Instance>
|
|
481
475
|
]=]
|
|
482
|
-
function RigBuilderUtils.promiseBasePlayerRig(
|
|
476
|
+
function RigBuilderUtils.promiseBasePlayerRig(
|
|
477
|
+
userId: number,
|
|
478
|
+
humanoidRigType: Enum.HumanoidRigType?,
|
|
479
|
+
assetTypeVerification: Enum.AssetTypeVerification?
|
|
480
|
+
): Promise.Promise<Model>
|
|
483
481
|
assert(type(userId) == "number", "Bad userId")
|
|
484
482
|
assert(typeof(humanoidRigType) == "EnumItem" or humanoidRigType == nil, "Bad humanoidRigType")
|
|
485
483
|
assert(typeof(assetTypeVerification) == "EnumItem" or assetTypeVerification == nil, "Bad assetTypeVerification")
|
|
486
484
|
|
|
487
|
-
return HumanoidDescriptionUtils.promiseFromUserId(userId)
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
485
|
+
return HumanoidDescriptionUtils.promiseFromUserId(userId):Then(function(playerHumanoidDescription)
|
|
486
|
+
-- Wipe accessories
|
|
487
|
+
local humanoidDescription = playerHumanoidDescription:Clone()
|
|
488
|
+
humanoidDescription.BackAccessory = ""
|
|
489
|
+
humanoidDescription.FaceAccessory = ""
|
|
490
|
+
humanoidDescription.FrontAccessory = ""
|
|
491
|
+
humanoidDescription.HairAccessory = ""
|
|
492
|
+
humanoidDescription.HatAccessory = ""
|
|
493
|
+
humanoidDescription.NeckAccessory = ""
|
|
494
|
+
humanoidDescription.ShouldersAccessory = ""
|
|
495
|
+
humanoidDescription.WaistAccessory = ""
|
|
496
|
+
humanoidDescription.GraphicTShirt = 0
|
|
497
|
+
humanoidDescription.Shirt = 0
|
|
498
|
+
humanoidDescription.Pants = 0
|
|
499
|
+
humanoidDescription:SetAccessories({}, true)
|
|
500
|
+
|
|
501
|
+
return RigBuilderUtils.promiseHumanoidModelFromDescription(
|
|
502
|
+
humanoidDescription,
|
|
503
|
+
humanoidRigType,
|
|
504
|
+
assetTypeVerification
|
|
505
|
+
)
|
|
506
|
+
end)
|
|
506
507
|
end
|
|
507
508
|
|
|
508
|
-
function RigBuilderUtils.promiseHumanoidModelFromDescription(
|
|
509
|
+
function RigBuilderUtils.promiseHumanoidModelFromDescription(
|
|
510
|
+
description: HumanoidDescription,
|
|
511
|
+
rigType: Enum.HumanoidRigType?,
|
|
512
|
+
assetTypeVerification: Enum.AssetTypeVerification?
|
|
513
|
+
): Promise.Promise<Model>
|
|
509
514
|
assert(typeof(description) == "Instance" and description:IsA("HumanoidDescription"), "Bad description")
|
|
510
515
|
assert(typeof(rigType) == "EnumItem" or rigType == nil, "Bad rigType")
|
|
511
516
|
assert(typeof(assetTypeVerification) == "EnumItem" or assetTypeVerification == nil, "Bad assetTypeVerification")
|
|
@@ -516,7 +521,8 @@ function RigBuilderUtils.promiseHumanoidModelFromDescription(description, rigTyp
|
|
|
516
521
|
model = Players:CreateHumanoidModelFromDescription(
|
|
517
522
|
description,
|
|
518
523
|
rigType or Enum.HumanoidRigType.R15,
|
|
519
|
-
assetTypeVerification or Enum.AssetTypeVerification.Default
|
|
524
|
+
assetTypeVerification or Enum.AssetTypeVerification.Default
|
|
525
|
+
)
|
|
520
526
|
end)
|
|
521
527
|
if not ok then
|
|
522
528
|
return reject(err or "Failed to create model")
|
|
@@ -529,7 +535,11 @@ function RigBuilderUtils.promiseHumanoidModelFromDescription(description, rigTyp
|
|
|
529
535
|
end)
|
|
530
536
|
end
|
|
531
537
|
|
|
532
|
-
function RigBuilderUtils.promiseHumanoidModelFromUserId(
|
|
538
|
+
function RigBuilderUtils.promiseHumanoidModelFromUserId(
|
|
539
|
+
userId: number,
|
|
540
|
+
rigType: Enum.HumanoidRigType?,
|
|
541
|
+
assetTypeVerification: Enum.AssetTypeVerification?
|
|
542
|
+
): Promise.Promise<Model>
|
|
533
543
|
assert(type(userId) == "number", "Bad userId")
|
|
534
544
|
assert(typeof(rigType) == "EnumItem" or rigType == nil, "Bad rigType")
|
|
535
545
|
assert(typeof(assetTypeVerification) == "EnumItem" or assetTypeVerification == nil, "Bad assetTypeVerification")
|
|
@@ -540,9 +550,10 @@ function RigBuilderUtils.promiseHumanoidModelFromUserId(userId, rigType, assetTy
|
|
|
540
550
|
model = Players:CreateHumanoidModelFromUserId(
|
|
541
551
|
userId,
|
|
542
552
|
rigType or Enum.HumanoidRigType.R15,
|
|
543
|
-
assetTypeVerification or Enum.AssetTypeVerification.Default
|
|
553
|
+
assetTypeVerification or Enum.AssetTypeVerification.Default
|
|
554
|
+
)
|
|
544
555
|
|
|
545
|
-
for _, item in
|
|
556
|
+
for _, item in model:GetDescendants() do
|
|
546
557
|
if item:IsA("LocalScript") then
|
|
547
558
|
item.Enabled = false
|
|
548
559
|
end
|
|
@@ -564,7 +575,7 @@ end
|
|
|
564
575
|
@param userId number
|
|
565
576
|
@return Promise<Instance>
|
|
566
577
|
]=]
|
|
567
|
-
function RigBuilderUtils.promisePlayerRig(userId)
|
|
578
|
+
function RigBuilderUtils.promisePlayerRig(userId: number): Promise.Promise<Model>
|
|
568
579
|
assert(type(userId) == "number", "Bad userId")
|
|
569
580
|
|
|
570
581
|
return RigBuilderUtils.promiseHumanoidModelFromUserId(userId)
|
|
@@ -45,7 +45,7 @@ return function(target)
|
|
|
45
45
|
RigBuilderUtils.promisePlayerRig(676056)
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
for index, rig in
|
|
48
|
+
for index, rig in rigs do
|
|
49
49
|
local offset = ((index - 0.5)/#rigs - 0.5)*#rigs*4
|
|
50
50
|
if Promise.isPromise(rig) then
|
|
51
51
|
maid:GivePromise(rig):Then(function(actualRig)
|