@quenty/ragdoll 11.0.0 → 12.0.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 +52 -0
- package/package.json +27 -25
- package/src/Shared/Rigging/RagdollBallSocketUtils.lua +88 -169
- package/src/Shared/Rigging/RagdollMotorData.lua +12 -0
- package/src/Shared/Rigging/RagdollMotorLimitData.lua +125 -0
- package/src/Shared/Rigging/RagdollMotorUtils.lua +17 -16
- package/src/Shared/RagdollConstants.lua +0 -17
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,58 @@
|
|
|
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
|
+
# [12.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ragdoll@11.0.0...@quenty/ragdoll@12.0.0) (2024-02-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* New loader (breaking changes), fixing loader issues ([#439](https://github.com/Quenty/NevermoreEngine/issues/439)) ([3534345](https://github.com/Quenty/NevermoreEngine/commit/353434522918812953bd9f13fece73e27a4d034d))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* Standard loader
|
|
17
|
+
|
|
18
|
+
Adds new loader version which replicates full structure instead of some partial structure. This allows us to have hot-reloading (in the future), as well as generally do less computation, handle dependencies more carefully, and other changes.
|
|
19
|
+
|
|
20
|
+
This means you'll need to change you how require client-side modules, as we export a simple `loader` module instead of all modules available.
|
|
21
|
+
|
|
22
|
+
Signed-off-by: James Onnen <jonnen0@gmail.com>
|
|
23
|
+
|
|
24
|
+
* fix: Fix missing dependency in ResetService
|
|
25
|
+
|
|
26
|
+
* feat: Add RxPhysicsUtils.observePartMass
|
|
27
|
+
|
|
28
|
+
* fix: Fix package discovery for games
|
|
29
|
+
|
|
30
|
+
* feat: Add UIAlignmentUtils.verticalToHorizontalAlignment(verticalAlignment) and UIAlignmentUtils.horizontalToVerticalAlignment(horizontalAlignment)
|
|
31
|
+
|
|
32
|
+
* feat: AdorneeData:InitAttributes() does not require data as a secondparameter
|
|
33
|
+
|
|
34
|
+
* ci: Upgrade to new rojo 7.4.0
|
|
35
|
+
|
|
36
|
+
* fix: Update loader to handle hoarcekat properly
|
|
37
|
+
|
|
38
|
+
* docs: Fix spacing in Maid
|
|
39
|
+
|
|
40
|
+
* fix: Add new ragdoll constants
|
|
41
|
+
|
|
42
|
+
* fix: Compress influxDB sends
|
|
43
|
+
|
|
44
|
+
* style: Errors use string.format
|
|
45
|
+
|
|
46
|
+
* fix: Handle motor animations
|
|
47
|
+
|
|
48
|
+
* ci: Upgrade rojo version
|
|
49
|
+
|
|
50
|
+
* feat!: Maid no longer is includd in ValueObject.Changed event
|
|
51
|
+
|
|
52
|
+
* docs: Fix docs
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
6
58
|
# [11.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ragdoll@10.5.0...@quenty/ragdoll@11.0.0) (2024-01-10)
|
|
7
59
|
|
|
8
60
|
**Note:** Version bump only for package @quenty/ragdoll
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/ragdoll",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"description": "Quenty's Ragdoll system for Roblox - Floppy fun ragdolls",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,37 +25,39 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/
|
|
29
|
-
"@quenty/
|
|
30
|
-
"@quenty/
|
|
31
|
-
"@quenty/
|
|
32
|
-
"@quenty/
|
|
28
|
+
"@quenty/adorneedata": "^4.0.0",
|
|
29
|
+
"@quenty/attributeutils": "^11.0.0",
|
|
30
|
+
"@quenty/baseobject": "^8.0.0",
|
|
31
|
+
"@quenty/binder": "^11.0.0",
|
|
32
|
+
"@quenty/brio": "^11.0.0",
|
|
33
|
+
"@quenty/camera": "^12.0.0",
|
|
33
34
|
"@quenty/cancellabledelay": "^3.4.0",
|
|
34
|
-
"@quenty/characterutils": "^
|
|
35
|
-
"@quenty/draw": "^
|
|
35
|
+
"@quenty/characterutils": "^9.0.0",
|
|
36
|
+
"@quenty/draw": "^5.0.0",
|
|
36
37
|
"@quenty/enumutils": "^3.1.0",
|
|
37
38
|
"@quenty/hapticfeedbackutils": "^3.1.0",
|
|
38
|
-
"@quenty/instanceutils": "^
|
|
39
|
-
"@quenty/loader": "^
|
|
40
|
-
"@quenty/maid": "^
|
|
41
|
-
"@quenty/motor6d": "^
|
|
42
|
-
"@quenty/
|
|
43
|
-
"@quenty/
|
|
44
|
-
"@quenty/
|
|
45
|
-
"@quenty/
|
|
46
|
-
"@quenty/
|
|
47
|
-
"@quenty/
|
|
48
|
-
"@quenty/
|
|
49
|
-
"@quenty/
|
|
50
|
-
"@quenty/
|
|
39
|
+
"@quenty/instanceutils": "^10.0.0",
|
|
40
|
+
"@quenty/loader": "^8.0.0",
|
|
41
|
+
"@quenty/maid": "^3.0.0",
|
|
42
|
+
"@quenty/motor6d": "^4.0.0",
|
|
43
|
+
"@quenty/physicsutils": "^5.0.0",
|
|
44
|
+
"@quenty/playerhumanoidbinder": "^11.0.0",
|
|
45
|
+
"@quenty/promise": "^8.0.0",
|
|
46
|
+
"@quenty/qframe": "^8.0.0",
|
|
47
|
+
"@quenty/r15utils": "^10.0.0",
|
|
48
|
+
"@quenty/remoting": "^9.0.0",
|
|
49
|
+
"@quenty/rx": "^10.0.0",
|
|
50
|
+
"@quenty/rxbinderutils": "^11.0.0",
|
|
51
|
+
"@quenty/rxsignal": "^4.0.0",
|
|
52
|
+
"@quenty/spring": "^8.0.0",
|
|
51
53
|
"@quenty/steputils": "^3.3.0",
|
|
52
54
|
"@quenty/table": "^3.4.0",
|
|
53
|
-
"@quenty/tie": "^
|
|
54
|
-
"@quenty/valuebaseutils": "^
|
|
55
|
-
"@quenty/valueobject": "^
|
|
55
|
+
"@quenty/tie": "^7.0.0",
|
|
56
|
+
"@quenty/valuebaseutils": "^10.0.0",
|
|
57
|
+
"@quenty/valueobject": "^10.0.0"
|
|
56
58
|
},
|
|
57
59
|
"publishConfig": {
|
|
58
60
|
"access": "public"
|
|
59
61
|
},
|
|
60
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "5736b108e4d23cd4c9e761bbe4cc9fed6fb32dfa"
|
|
61
63
|
}
|
|
@@ -9,105 +9,17 @@ local require = require(script.Parent.loader).load(script)
|
|
|
9
9
|
|
|
10
10
|
local Workspace = game:GetService("Workspace")
|
|
11
11
|
|
|
12
|
-
local RagdollConstants = require("RagdollConstants")
|
|
13
|
-
local RxAttributeUtils = require("RxAttributeUtils")
|
|
14
|
-
local AttributeUtils = require("AttributeUtils")
|
|
15
|
-
local RxR15Utils = require("RxR15Utils")
|
|
16
12
|
local EnumUtils = require("EnumUtils")
|
|
13
|
+
local Maid = require("Maid")
|
|
14
|
+
local RagdollMotorLimitData = require("RagdollMotorLimitData")
|
|
17
15
|
local RxBrioUtils = require("RxBrioUtils")
|
|
18
16
|
local RxInstanceUtils = require("RxInstanceUtils")
|
|
19
|
-
local
|
|
17
|
+
local RxR15Utils = require("RxR15Utils")
|
|
18
|
+
local Rx = require("Rx")
|
|
19
|
+
local RxPhysicsUtils = require("RxPhysicsUtils")
|
|
20
20
|
|
|
21
21
|
local RagdollBallSocketUtils = {}
|
|
22
22
|
|
|
23
|
-
local REFERENCE_GRAVITY = 196.2 -- Gravity that joint friction values were tuned under.
|
|
24
|
-
|
|
25
|
-
local HEAD_LIMITS = {
|
|
26
|
-
UpperAngle = 45,
|
|
27
|
-
TwistLowerAngle = -40,
|
|
28
|
-
TwistUpperAngle = 40,
|
|
29
|
-
FrictionTorque = 15, -- 400
|
|
30
|
-
ReferenceMass = 1.0249234437943,
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
local WAIST_LIMITS = {
|
|
34
|
-
UpperAngle = 20,
|
|
35
|
-
TwistLowerAngle = -40,
|
|
36
|
-
TwistUpperAngle = 20,
|
|
37
|
-
FrictionTorque = 750,
|
|
38
|
-
ReferenceMass = 2.861558675766,
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
local ANKLE_LIMITS = {
|
|
42
|
-
UpperAngle = 10,
|
|
43
|
-
TwistLowerAngle = -10,
|
|
44
|
-
TwistUpperAngle = 10,
|
|
45
|
-
FrictionTorque = 0.5;
|
|
46
|
-
ReferenceMass = 0.43671694397926,
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
local ELBOW_LIMITS = {
|
|
50
|
-
-- Elbow is basically a hinge, but allow some twist for Supination and Pronation
|
|
51
|
-
UpperAngle = 20,
|
|
52
|
-
TwistLowerAngle = 5,
|
|
53
|
-
TwistUpperAngle = 120,
|
|
54
|
-
FrictionTorque = 0.5;
|
|
55
|
-
ReferenceMass = 0.70196455717087,
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
local WRIST_LIMITS = {
|
|
59
|
-
UpperAngle = 30,
|
|
60
|
-
TwistLowerAngle = -10,
|
|
61
|
-
TwistUpperAngle = 10,
|
|
62
|
-
FrictionTorque = 1;
|
|
63
|
-
ReferenceMass = 0.69132566452026,
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
local KNEE_LIMITS = {
|
|
67
|
-
UpperAngle = 5,
|
|
68
|
-
TwistLowerAngle = -120,
|
|
69
|
-
TwistUpperAngle = -5,
|
|
70
|
-
FrictionTorque = 0.5;
|
|
71
|
-
ReferenceMass = 0.65389388799667,
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
local SHOULDER_LIMITS = {
|
|
75
|
-
UpperAngle = 110,
|
|
76
|
-
TwistLowerAngle = -85,
|
|
77
|
-
TwistUpperAngle = 85,
|
|
78
|
-
FrictionTorque = 0.5,
|
|
79
|
-
ReferenceMass = 0.90918225049973,
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
local HIP_LIMITS = {
|
|
83
|
-
UpperAngle = 40,
|
|
84
|
-
TwistLowerAngle = -5,
|
|
85
|
-
TwistUpperAngle = 80,
|
|
86
|
-
FrictionTorque = 0.5,
|
|
87
|
-
ReferenceMass = 1.9175016880035,
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
local R6_HEAD_LIMITS = {
|
|
91
|
-
UpperAngle = 30,
|
|
92
|
-
TwistLowerAngle = -40,
|
|
93
|
-
TwistUpperAngle = 40,
|
|
94
|
-
FrictionTorque = 0.5;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
local R6_SHOULDER_LIMITS = {
|
|
98
|
-
UpperAngle = 110,
|
|
99
|
-
TwistLowerAngle = -85,
|
|
100
|
-
TwistUpperAngle = 85,
|
|
101
|
-
FrictionTorque = 0.5;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
local R6_HIP_LIMITS = {
|
|
105
|
-
UpperAngle = 40,
|
|
106
|
-
TwistLowerAngle = -5,
|
|
107
|
-
TwistUpperAngle = 80,
|
|
108
|
-
FrictionTorque = 0.5;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
23
|
local R6_RAGDOLL_RIG = {
|
|
112
24
|
{
|
|
113
25
|
part0Name = "Torso";
|
|
@@ -115,7 +27,7 @@ local R6_RAGDOLL_RIG = {
|
|
|
115
27
|
attachmentName = "NeckAttachment";
|
|
116
28
|
motorParentName = "Torso";
|
|
117
29
|
motorName = "Neck";
|
|
118
|
-
|
|
30
|
+
limitData = RagdollMotorLimitData.R6_NECK_LIMITS;
|
|
119
31
|
};
|
|
120
32
|
{
|
|
121
33
|
part0Name = "Torso";
|
|
@@ -123,7 +35,7 @@ local R6_RAGDOLL_RIG = {
|
|
|
123
35
|
attachmentName = "LeftHipAttachment";
|
|
124
36
|
motorParentName = "Torso";
|
|
125
37
|
motorName = "Left Hip";
|
|
126
|
-
|
|
38
|
+
limitData = RagdollMotorLimitData.R6_HIP_LIMITS;
|
|
127
39
|
};
|
|
128
40
|
{
|
|
129
41
|
part0Name = "Torso";
|
|
@@ -131,7 +43,7 @@ local R6_RAGDOLL_RIG = {
|
|
|
131
43
|
attachmentName = "RightHipAttachment";
|
|
132
44
|
motorParentName = "Torso";
|
|
133
45
|
motorName = "Right Hip";
|
|
134
|
-
|
|
46
|
+
limitData = RagdollMotorLimitData.R6_HIP_LIMITS;
|
|
135
47
|
};
|
|
136
48
|
{
|
|
137
49
|
part0Name = "Torso";
|
|
@@ -139,7 +51,7 @@ local R6_RAGDOLL_RIG = {
|
|
|
139
51
|
attachmentName = "LeftShoulderRagdollAttachment";
|
|
140
52
|
motorParentName = "Torso";
|
|
141
53
|
motorName = "Left Shoulder";
|
|
142
|
-
|
|
54
|
+
limitData = RagdollMotorLimitData.R6_SHOULDER_LIMITS;
|
|
143
55
|
};
|
|
144
56
|
{
|
|
145
57
|
part0Name = "Torso";
|
|
@@ -147,7 +59,7 @@ local R6_RAGDOLL_RIG = {
|
|
|
147
59
|
attachmentName = "RightShoulderRagdollAttachment";
|
|
148
60
|
motorParentName = "Torso";
|
|
149
61
|
motorName = "Right Shoulder";
|
|
150
|
-
|
|
62
|
+
limitData = RagdollMotorLimitData.R6_SHOULDER_LIMITS;
|
|
151
63
|
};
|
|
152
64
|
}
|
|
153
65
|
|
|
@@ -158,7 +70,7 @@ local R15_RAGDOLL_RIG = {
|
|
|
158
70
|
attachmentName = "NeckRigAttachment";
|
|
159
71
|
motorParentName = "Head";
|
|
160
72
|
motorName = "Neck";
|
|
161
|
-
|
|
73
|
+
limitData = RagdollMotorLimitData.NECK_LIMITS;
|
|
162
74
|
};
|
|
163
75
|
{
|
|
164
76
|
part0Name = "LowerTorso";
|
|
@@ -166,7 +78,7 @@ local R15_RAGDOLL_RIG = {
|
|
|
166
78
|
attachmentName = "WaistRigAttachment";
|
|
167
79
|
motorParentName = "UpperTorso";
|
|
168
80
|
motorName = "Waist";
|
|
169
|
-
|
|
81
|
+
limitData = RagdollMotorLimitData.WAIST_LIMITS;
|
|
170
82
|
};
|
|
171
83
|
{
|
|
172
84
|
part0Name = "UpperTorso";
|
|
@@ -174,7 +86,7 @@ local R15_RAGDOLL_RIG = {
|
|
|
174
86
|
attachmentName = "LeftShoulderRagdollAttachment";
|
|
175
87
|
motorParentName = "LeftUpperArm";
|
|
176
88
|
motorName = "LeftShoulder";
|
|
177
|
-
|
|
89
|
+
limitData = RagdollMotorLimitData.SHOULDER_LIMITS;
|
|
178
90
|
};
|
|
179
91
|
{
|
|
180
92
|
part0Name = "LeftUpperArm";
|
|
@@ -182,7 +94,7 @@ local R15_RAGDOLL_RIG = {
|
|
|
182
94
|
attachmentName = "LeftElbowRigAttachment";
|
|
183
95
|
motorParentName = "LeftLowerArm";
|
|
184
96
|
motorName = "LeftElbow";
|
|
185
|
-
|
|
97
|
+
limitData = RagdollMotorLimitData.ELBOW_LIMITS;
|
|
186
98
|
};
|
|
187
99
|
{
|
|
188
100
|
part0Name = "LeftLowerArm";
|
|
@@ -190,7 +102,7 @@ local R15_RAGDOLL_RIG = {
|
|
|
190
102
|
attachmentName = "LeftWristRigAttachment";
|
|
191
103
|
motorParentName = "LeftHand";
|
|
192
104
|
motorName = "LeftWrist";
|
|
193
|
-
|
|
105
|
+
limitData = RagdollMotorLimitData.WRIST_LIMITS;
|
|
194
106
|
};
|
|
195
107
|
{
|
|
196
108
|
part0Name = "UpperTorso";
|
|
@@ -198,7 +110,7 @@ local R15_RAGDOLL_RIG = {
|
|
|
198
110
|
attachmentName = "RightShoulderRagdollAttachment";
|
|
199
111
|
motorParentName = "RightUpperArm";
|
|
200
112
|
motorName = "RightShoulder";
|
|
201
|
-
|
|
113
|
+
limitData = RagdollMotorLimitData.SHOULDER_LIMITS;
|
|
202
114
|
};
|
|
203
115
|
{
|
|
204
116
|
part0Name = "RightUpperArm";
|
|
@@ -206,7 +118,7 @@ local R15_RAGDOLL_RIG = {
|
|
|
206
118
|
attachmentName = "RightElbowRigAttachment";
|
|
207
119
|
motorParentName = "RightLowerArm";
|
|
208
120
|
motorName = "RightElbow";
|
|
209
|
-
|
|
121
|
+
limitData = RagdollMotorLimitData.ELBOW_LIMITS;
|
|
210
122
|
};
|
|
211
123
|
{
|
|
212
124
|
part0Name = "RightLowerArm";
|
|
@@ -214,7 +126,7 @@ local R15_RAGDOLL_RIG = {
|
|
|
214
126
|
attachmentName = "RightWristRigAttachment";
|
|
215
127
|
motorParentName = "RightHand";
|
|
216
128
|
motorName = "RightWrist";
|
|
217
|
-
|
|
129
|
+
limitData = RagdollMotorLimitData.WRIST_LIMITS;
|
|
218
130
|
};
|
|
219
131
|
|
|
220
132
|
{
|
|
@@ -223,7 +135,7 @@ local R15_RAGDOLL_RIG = {
|
|
|
223
135
|
attachmentName = "LeftHipRigAttachment";
|
|
224
136
|
motorParentName = "LeftUpperLeg";
|
|
225
137
|
motorName = "LeftHip";
|
|
226
|
-
|
|
138
|
+
limitData = RagdollMotorLimitData.HIP_LIMITS;
|
|
227
139
|
};
|
|
228
140
|
{
|
|
229
141
|
part0Name = "LeftUpperLeg";
|
|
@@ -231,7 +143,7 @@ local R15_RAGDOLL_RIG = {
|
|
|
231
143
|
attachmentName = "LeftKneeRigAttachment";
|
|
232
144
|
motorParentName = "LeftLowerLeg";
|
|
233
145
|
motorName = "LeftKnee";
|
|
234
|
-
|
|
146
|
+
limitData = RagdollMotorLimitData.KNEE_LIMITS;
|
|
235
147
|
};
|
|
236
148
|
{
|
|
237
149
|
part0Name = "LeftLowerLeg";
|
|
@@ -239,7 +151,7 @@ local R15_RAGDOLL_RIG = {
|
|
|
239
151
|
attachmentName = "LeftAnkleRigAttachment";
|
|
240
152
|
motorParentName = "LeftFoot";
|
|
241
153
|
motorName = "LeftAnkle";
|
|
242
|
-
|
|
154
|
+
limitData = RagdollMotorLimitData.ANKLE_LIMITS;
|
|
243
155
|
};
|
|
244
156
|
|
|
245
157
|
{
|
|
@@ -248,7 +160,7 @@ local R15_RAGDOLL_RIG = {
|
|
|
248
160
|
attachmentName = "RightHipRigAttachment";
|
|
249
161
|
motorParentName = "RightUpperLeg";
|
|
250
162
|
motorName = "RightHip";
|
|
251
|
-
|
|
163
|
+
limitData = RagdollMotorLimitData.HIP_LIMITS;
|
|
252
164
|
};
|
|
253
165
|
{
|
|
254
166
|
part0Name = "RightUpperLeg";
|
|
@@ -256,7 +168,7 @@ local R15_RAGDOLL_RIG = {
|
|
|
256
168
|
attachmentName = "RightKneeRigAttachment";
|
|
257
169
|
motorParentName = "RightLowerLeg";
|
|
258
170
|
motorName = "RightKnee";
|
|
259
|
-
|
|
171
|
+
limitData = RagdollMotorLimitData.KNEE_LIMITS;
|
|
260
172
|
};
|
|
261
173
|
{
|
|
262
174
|
part0Name = "RightLowerLeg";
|
|
@@ -264,7 +176,7 @@ local R15_RAGDOLL_RIG = {
|
|
|
264
176
|
attachmentName = "RightAnkleRigAttachment";
|
|
265
177
|
motorParentName = "RightFoot";
|
|
266
178
|
motorName = "RightAnkle";
|
|
267
|
-
|
|
179
|
+
limitData = RagdollMotorLimitData.ANKLE_LIMITS;
|
|
268
180
|
};
|
|
269
181
|
}
|
|
270
182
|
|
|
@@ -289,67 +201,74 @@ function RagdollBallSocketUtils.ensureBallSockets(character, rigType)
|
|
|
289
201
|
local part1Name = assert(data.part1Name, "No part1Name")
|
|
290
202
|
local motorName = assert(data.motorName, "No motorName")
|
|
291
203
|
local attachmentName = assert(data.attachmentName, "No attachmentName")
|
|
292
|
-
local
|
|
293
|
-
|
|
294
|
-
local observable =
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
204
|
+
local limitData = assert(data.limitData, "No limits")
|
|
205
|
+
|
|
206
|
+
local observable = RxR15Utils.observeRigMotorBrio(character, data.motorParentName, motorName):Pipe({
|
|
207
|
+
RxBrioUtils.switchMapBrio(function(motor)
|
|
208
|
+
if motor then
|
|
209
|
+
return RxBrioUtils.flatCombineLatest({
|
|
210
|
+
motor = Rx.of(motor);
|
|
211
|
+
part1 = RxR15Utils.observeCharacterPartBrio(character, part1Name);
|
|
212
|
+
attachment0 = RxR15Utils.observeRigAttachmentBrio(character, part0Name, attachmentName);
|
|
213
|
+
attachment1 = RxR15Utils.observeRigAttachmentBrio(character, part1Name, attachmentName);
|
|
214
|
+
limitData = Rx.of(limitData);
|
|
215
|
+
})
|
|
216
|
+
else
|
|
217
|
+
return Rx.of({})
|
|
218
|
+
end
|
|
219
|
+
end);
|
|
220
|
+
RxBrioUtils.where(function(motorState)
|
|
221
|
+
return motorState.attachment0 and motorState.attachment1 and motorState.part1 and motorState.motor and true or false
|
|
222
|
+
end);
|
|
300
223
|
})
|
|
301
224
|
|
|
302
|
-
topMaid:GiveTask(observable:Subscribe(function(
|
|
303
|
-
if
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
local ballSocket = Instance.new("BallSocketConstraint")
|
|
307
|
-
ballSocket.Name = "RagdollBallSocket"
|
|
308
|
-
ballSocket.Enabled = true
|
|
309
|
-
ballSocket.LimitsEnabled = true
|
|
310
|
-
ballSocket.UpperAngle = limits.UpperAngle
|
|
311
|
-
ballSocket.TwistLimitsEnabled = true
|
|
312
|
-
ballSocket.TwistLowerAngle = limits.TwistLowerAngle
|
|
313
|
-
ballSocket.TwistUpperAngle = limits.TwistUpperAngle
|
|
314
|
-
ballSocket.Attachment0 = state.attachment0
|
|
315
|
-
ballSocket.Attachment1 = state.attachment1
|
|
316
|
-
|
|
317
|
-
local default = assert(limits.FrictionTorque, "No FrictionTorque")
|
|
318
|
-
|
|
319
|
-
-- Easier debugging
|
|
320
|
-
AttributeUtils.initAttribute(state.motor, RagdollConstants.FRICTION_TORQUE_ATTRIBUTE, default)
|
|
321
|
-
AttributeUtils.initAttribute(state.motor, RagdollConstants.UPPER_ANGLE_ATTRIBUTE, limits.UpperAngle)
|
|
322
|
-
AttributeUtils.initAttribute(state.motor, RagdollConstants.TWIST_LOWER_ANGLE_ATTRIBUTE, limits.TwistLowerAngle)
|
|
323
|
-
AttributeUtils.initAttribute(state.motor, RagdollConstants.TWIST_UPPER_ANGLE_ATTRIBUTE, limits.TwistUpperAngle)
|
|
324
|
-
|
|
325
|
-
maid:GiveTask(RxAttributeUtils.observeAttribute(state.motor, RagdollConstants.UPPER_ANGLE_ATTRIBUTE, limits.UpperAngle)
|
|
326
|
-
:Subscribe(function(value)
|
|
327
|
-
ballSocket.UpperAngle = value
|
|
328
|
-
end))
|
|
329
|
-
maid:GiveTask(RxAttributeUtils.observeAttribute(state.motor, RagdollConstants.TWIST_LOWER_ANGLE_ATTRIBUTE, limits.TwistLowerAngle)
|
|
330
|
-
:Subscribe(function(value)
|
|
331
|
-
ballSocket.TwistLowerAngle = value
|
|
332
|
-
end))
|
|
333
|
-
maid:GiveTask(RxAttributeUtils.observeAttribute(state.motor, RagdollConstants.TWIST_UPPER_ANGLE_ATTRIBUTE, limits.TwistUpperAngle)
|
|
334
|
-
:Subscribe(function(value)
|
|
335
|
-
ballSocket.TwistUpperAngle = value
|
|
336
|
-
end))
|
|
337
|
-
|
|
338
|
-
maid:GiveTask(RxAttributeUtils.observeAttribute(state.motor, RagdollConstants.FRICTION_TORQUE_ATTRIBUTE, default)
|
|
339
|
-
:Subscribe(function(torque)
|
|
340
|
-
local gravityScale = state.gravity / REFERENCE_GRAVITY
|
|
341
|
-
local referenceMass = limits.ReferenceMass
|
|
342
|
-
local massScale = referenceMass and (state.part1:GetMass() / referenceMass) or 1
|
|
343
|
-
ballSocket.MaxFrictionTorque = torque * massScale * gravityScale
|
|
344
|
-
end))
|
|
225
|
+
topMaid:GiveTask(observable:Subscribe(function(brio)
|
|
226
|
+
if brio:IsDead() then
|
|
227
|
+
return
|
|
228
|
+
end
|
|
345
229
|
|
|
346
|
-
|
|
347
|
-
|
|
230
|
+
local maid, motorState = brio:ToMaidAndValue()
|
|
231
|
+
local limitValue = motorState.limitData:CreateAdorneeDataValue(motorState.motor)
|
|
232
|
+
|
|
233
|
+
local ballSocket = maid:Add(Instance.new("BallSocketConstraint"))
|
|
234
|
+
ballSocket.Name = "RagdollBallSocket"
|
|
235
|
+
ballSocket.Enabled = true
|
|
236
|
+
ballSocket.LimitsEnabled = true
|
|
237
|
+
ballSocket.UpperAngle = limitValue.UpperAngle.Value
|
|
238
|
+
ballSocket.TwistLimitsEnabled = true
|
|
239
|
+
ballSocket.TwistLowerAngle = limitValue.TwistLowerAngle.Value
|
|
240
|
+
ballSocket.TwistUpperAngle = limitValue.TwistUpperAngle.Value
|
|
241
|
+
ballSocket.Attachment0 = motorState.attachment0
|
|
242
|
+
ballSocket.Attachment1 = motorState.attachment1
|
|
243
|
+
|
|
244
|
+
maid:GiveTask(limitValue.UpperAngle:Observe()
|
|
245
|
+
:Subscribe(function(value)
|
|
246
|
+
ballSocket.UpperAngle = value
|
|
247
|
+
end))
|
|
248
|
+
maid:GiveTask(limitValue.TwistLowerAngle:Observe()
|
|
249
|
+
:Subscribe(function(value)
|
|
250
|
+
ballSocket.TwistLowerAngle = value
|
|
251
|
+
end))
|
|
252
|
+
maid:GiveTask(limitValue.TwistUpperAngle:Observe()
|
|
253
|
+
:Subscribe(function(value)
|
|
254
|
+
ballSocket.TwistUpperAngle = value
|
|
255
|
+
end))
|
|
256
|
+
|
|
257
|
+
maid:GiveTask(Rx.combineLatest({
|
|
258
|
+
frictionTorque = limitValue.FrictionTorque:Observe();
|
|
259
|
+
referenceGravity = limitValue.ReferenceGravity:Observe();
|
|
260
|
+
referenceMass = limitValue.ReferenceMass:Observe();
|
|
261
|
+
gravity = RxInstanceUtils.observeProperty(Workspace, "Gravity");
|
|
262
|
+
mass = RxPhysicsUtils.observePartMass(motorState.part1);
|
|
263
|
+
}):Subscribe(function(state)
|
|
264
|
+
local gravityScale = state.gravity / state.referenceGravity
|
|
265
|
+
local referenceMass = state.referenceMass;
|
|
266
|
+
local massScale = referenceMass and (state.mass / referenceMass) or 1
|
|
267
|
+
ballSocket.MaxFrictionTorque = state.frictionTorque * massScale * gravityScale
|
|
268
|
+
end))
|
|
269
|
+
|
|
270
|
+
ballSocket.Parent = motorState.part1
|
|
348
271
|
|
|
349
|
-
topMaid[data] = maid
|
|
350
|
-
else
|
|
351
|
-
topMaid[data] = nil
|
|
352
|
-
end
|
|
353
272
|
end))
|
|
354
273
|
end
|
|
355
274
|
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
--[=[
|
|
2
|
+
Holds baseline constants for the Ragdoll
|
|
3
|
+
|
|
4
|
+
:::tip
|
|
5
|
+
Do not modify this file. Instead, do this to apply new reference values.
|
|
6
|
+
|
|
7
|
+
```lua
|
|
8
|
+
RagdollMotorLimitData.NECK_LIMITS:SetAttributes(character.UpperTorso.Neck, {
|
|
9
|
+
UpperAngle = 30;
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
:::
|
|
14
|
+
|
|
15
|
+
@class RagdollMotorLimitData
|
|
16
|
+
]=]
|
|
17
|
+
|
|
18
|
+
local require = require(script.Parent.loader).load(script)
|
|
19
|
+
|
|
20
|
+
local AdorneeData = require("AdorneeData")
|
|
21
|
+
local Table = require("Table")
|
|
22
|
+
|
|
23
|
+
return Table.readonly({
|
|
24
|
+
NECK_LIMITS = AdorneeData.new({
|
|
25
|
+
UpperAngle = 45;
|
|
26
|
+
TwistLowerAngle = -40;
|
|
27
|
+
TwistUpperAngle = 40;
|
|
28
|
+
FrictionTorque = 15;
|
|
29
|
+
ReferenceGravity = 196.2;
|
|
30
|
+
ReferenceMass = 1.0249234437943;
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
WAIST_LIMITS = AdorneeData.new({
|
|
34
|
+
UpperAngle = 20;
|
|
35
|
+
TwistLowerAngle = -40;
|
|
36
|
+
TwistUpperAngle = 20;
|
|
37
|
+
FrictionTorque = 750;
|
|
38
|
+
ReferenceGravity = 196.2;
|
|
39
|
+
ReferenceMass = 2.861558675766;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
ANKLE_LIMITS = AdorneeData.new({
|
|
43
|
+
UpperAngle = 10;
|
|
44
|
+
TwistLowerAngle = -10;
|
|
45
|
+
TwistUpperAngle = 10;
|
|
46
|
+
FrictionTorque = 0.5;
|
|
47
|
+
ReferenceGravity = 196.2;
|
|
48
|
+
ReferenceMass = 0.43671694397926;
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
ELBOW_LIMITS = AdorneeData.new({
|
|
52
|
+
-- Elbow is basically a hinge; but allow some twist for Supination and Pronation
|
|
53
|
+
UpperAngle = 20;
|
|
54
|
+
TwistLowerAngle = 5;
|
|
55
|
+
TwistUpperAngle = 120;
|
|
56
|
+
FrictionTorque = 0.5;
|
|
57
|
+
ReferenceGravity = 196.2;
|
|
58
|
+
ReferenceMass = 0.70196455717087;
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
WRIST_LIMITS = AdorneeData.new({
|
|
62
|
+
UpperAngle = 30;
|
|
63
|
+
TwistLowerAngle = -10;
|
|
64
|
+
TwistUpperAngle = 10;
|
|
65
|
+
FrictionTorque = 1;
|
|
66
|
+
ReferenceGravity = 196.2;
|
|
67
|
+
ReferenceMass = 0.69132566452026;
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
KNEE_LIMITS = AdorneeData.new({
|
|
71
|
+
UpperAngle = 5;
|
|
72
|
+
TwistLowerAngle = -120;
|
|
73
|
+
TwistUpperAngle = -5;
|
|
74
|
+
FrictionTorque = 0.5;
|
|
75
|
+
ReferenceGravity = 196.2;
|
|
76
|
+
ReferenceMass = 0.65389388799667;
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
SHOULDER_LIMITS = AdorneeData.new({
|
|
80
|
+
UpperAngle = 110;
|
|
81
|
+
TwistLowerAngle = -85;
|
|
82
|
+
TwistUpperAngle = 85;
|
|
83
|
+
FrictionTorque = 0.5;
|
|
84
|
+
ReferenceGravity = 196.2;
|
|
85
|
+
ReferenceMass = 0.90918225049973;
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
HIP_LIMITS = AdorneeData.new({
|
|
89
|
+
UpperAngle = 40;
|
|
90
|
+
TwistLowerAngle = -5;
|
|
91
|
+
TwistUpperAngle = 80;
|
|
92
|
+
FrictionTorque = 0.5;
|
|
93
|
+
ReferenceGravity = 196.2;
|
|
94
|
+
ReferenceMass = 1.9175016880035;
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
-- R6
|
|
98
|
+
|
|
99
|
+
R6_NECK_LIMITS = AdorneeData.new({
|
|
100
|
+
UpperAngle = 30;
|
|
101
|
+
TwistLowerAngle = -40;
|
|
102
|
+
TwistUpperAngle = 40;
|
|
103
|
+
FrictionTorque = 0.5;
|
|
104
|
+
ReferenceGravity = 196.2;
|
|
105
|
+
ReferenceMass = 1.4;
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
R6_SHOULDER_LIMITS = AdorneeData.new({
|
|
109
|
+
UpperAngle = 110;
|
|
110
|
+
TwistLowerAngle = -85;
|
|
111
|
+
TwistUpperAngle = 85;
|
|
112
|
+
FrictionTorque = 0.5;
|
|
113
|
+
ReferenceGravity = 196.2;
|
|
114
|
+
ReferenceMass = 1.4;
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
R6_HIP_LIMITS = AdorneeData.new({
|
|
118
|
+
UpperAngle = 40;
|
|
119
|
+
TwistLowerAngle = -5;
|
|
120
|
+
TwistUpperAngle = 80;
|
|
121
|
+
FrictionTorque = 0.5;
|
|
122
|
+
ReferenceGravity = 196.2;
|
|
123
|
+
ReferenceMass = 1.4;
|
|
124
|
+
});
|
|
125
|
+
})
|
|
@@ -7,28 +7,23 @@ local require = require(script.Parent.loader).load(script)
|
|
|
7
7
|
local RunService = game:GetService("RunService")
|
|
8
8
|
local Players = game:GetService("Players")
|
|
9
9
|
|
|
10
|
-
local AttributeUtils = require("AttributeUtils")
|
|
11
10
|
local CharacterUtils = require("CharacterUtils")
|
|
12
11
|
local EnumUtils = require("EnumUtils")
|
|
13
12
|
local Maid = require("Maid")
|
|
13
|
+
local Motor6DStackInterface = require("Motor6DStackInterface")
|
|
14
14
|
local Promise = require("Promise")
|
|
15
15
|
local QFrame = require("QFrame")
|
|
16
16
|
local R15Utils = require("R15Utils")
|
|
17
|
-
local
|
|
18
|
-
local
|
|
17
|
+
local RagdollCollisionUtils = require("RagdollCollisionUtils")
|
|
18
|
+
local RagdollMotorData = require("RagdollMotorData")
|
|
19
|
+
local Rx = require("Rx")
|
|
19
20
|
local RxBrioUtils = require("RxBrioUtils")
|
|
20
21
|
local RxInstanceUtils = require("RxInstanceUtils")
|
|
21
22
|
local RxR15Utils = require("RxR15Utils")
|
|
22
23
|
local Spring = require("Spring")
|
|
23
|
-
local RagdollCollisionUtils = require("RagdollCollisionUtils")
|
|
24
|
-
local Motor6DStackInterface = require("Motor6DStackInterface")
|
|
25
|
-
local Rx = require("Rx")
|
|
26
24
|
|
|
27
25
|
local RagdollMotorUtils = {}
|
|
28
26
|
|
|
29
|
-
-- For easier debugging
|
|
30
|
-
local DEFAULT_SPRING_SPEED = 20
|
|
31
|
-
|
|
32
27
|
local R6_MOTORS = {
|
|
33
28
|
{
|
|
34
29
|
partName = "Torso";
|
|
@@ -155,8 +150,7 @@ function RagdollMotorUtils.initMotorAttributes(character, rigType)
|
|
|
155
150
|
for _, data in pairs(RagdollMotorUtils.getMotorData(rigType)) do
|
|
156
151
|
local motor = R15Utils.getRigMotor(character, data.partName, data.motorName)
|
|
157
152
|
if motor then
|
|
158
|
-
|
|
159
|
-
AttributeUtils.initAttribute(motor, RagdollConstants.RETURN_SPRING_SPEED_ATTRIBUTE, DEFAULT_SPRING_SPEED)
|
|
153
|
+
RagdollMotorData:InitAttributes(motor)
|
|
160
154
|
end
|
|
161
155
|
end
|
|
162
156
|
end
|
|
@@ -174,6 +168,8 @@ end
|
|
|
174
168
|
function RagdollMotorUtils.setupRagdollRootPartMotor(motor, part0, part1)
|
|
175
169
|
local maid = Maid.new()
|
|
176
170
|
|
|
171
|
+
local ragdollMotorData = RagdollMotorData:CreateValue(motor)
|
|
172
|
+
|
|
177
173
|
local lastTransformSpring = Spring.new(QFrame.fromCFrameClosestTo(motor.Transform, QFrame.new()))
|
|
178
174
|
lastTransformSpring.t = QFrame.new()
|
|
179
175
|
|
|
@@ -231,7 +227,7 @@ function RagdollMotorUtils.setupRagdollRootPartMotor(motor, part0, part1)
|
|
|
231
227
|
maid._weld = setupWeld("Weld")
|
|
232
228
|
end
|
|
233
229
|
|
|
234
|
-
maid:GiveTask(
|
|
230
|
+
maid:GiveTask(ragdollMotorData.RagdollSpringReturnSpeed:Observe()
|
|
235
231
|
:Subscribe(function(speed)
|
|
236
232
|
lastTransformSpring.s = speed
|
|
237
233
|
end))
|
|
@@ -261,8 +257,9 @@ function RagdollMotorUtils.setupRagdollMotor(motor, part0, part1)
|
|
|
261
257
|
maid:GiveTask(function()
|
|
262
258
|
local implemention = Motor6DStackInterface:FindFirstImplementation(motor)
|
|
263
259
|
if implemention then
|
|
260
|
+
local ragdollMotorData = RagdollMotorData:CreateValue(motor)
|
|
264
261
|
local initialTransform = (part0.CFrame * motor.C0):toObjectSpace(part1.CFrame * motor.C1)
|
|
265
|
-
local speed =
|
|
262
|
+
local speed = ragdollMotorData.RagdollSpringReturnSpeed.Value
|
|
266
263
|
|
|
267
264
|
implemention:TransformFromCFrame(initialTransform, speed)
|
|
268
265
|
end
|
|
@@ -282,11 +279,13 @@ function RagdollMotorUtils.suppressJustRootPart(character, rigType)
|
|
|
282
279
|
|
|
283
280
|
local observable = RxR15Utils.observeRigMotorBrio(character, data.partName, data.motorName):Pipe({
|
|
284
281
|
RxBrioUtils.switchMapBrio(function(motor)
|
|
285
|
-
|
|
282
|
+
local ragdollMotorData = RagdollMotorData:CreateValue(motor)
|
|
283
|
+
|
|
284
|
+
return Rx.combineLatest({
|
|
286
285
|
motor = motor;
|
|
287
286
|
part0 = RxInstanceUtils.observeProperty(motor, "Part0");
|
|
288
287
|
part1 = RxInstanceUtils.observeProperty(motor, "Part1");
|
|
289
|
-
isAnimated =
|
|
288
|
+
isAnimated = ragdollMotorData.IsMotorAnimated:Observe();
|
|
290
289
|
})
|
|
291
290
|
end);
|
|
292
291
|
})
|
|
@@ -324,11 +323,13 @@ function RagdollMotorUtils.suppressMotors(character, rigType, velocityReadings)
|
|
|
324
323
|
for _, data in pairs(RagdollMotorUtils.getMotorData(rigType)) do
|
|
325
324
|
local observable = RxR15Utils.observeRigMotorBrio(character, data.partName, data.motorName):Pipe({
|
|
326
325
|
RxBrioUtils.switchMapBrio(function(motor)
|
|
326
|
+
local ragdollMotorData = RagdollMotorData:CreateValue(motor)
|
|
327
|
+
|
|
327
328
|
return RxBrioUtils.flatCombineLatest({
|
|
328
329
|
motor = motor;
|
|
329
330
|
part0 = RxInstanceUtils.observeProperty(motor, "Part0");
|
|
330
331
|
part1 = RxInstanceUtils.observeProperty(motor, "Part1");
|
|
331
|
-
isAnimated =
|
|
332
|
+
isAnimated = ragdollMotorData.IsMotorAnimated:Observe();
|
|
332
333
|
})
|
|
333
334
|
end);
|
|
334
335
|
})
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
--[=[
|
|
2
|
-
Constants for the [Ragdoll] class.
|
|
3
|
-
@class RagdollConstants
|
|
4
|
-
]=]
|
|
5
|
-
|
|
6
|
-
local require = require(script.Parent.loader).load(script)
|
|
7
|
-
|
|
8
|
-
local Table = require("Table")
|
|
9
|
-
|
|
10
|
-
return Table.readonly({
|
|
11
|
-
IS_MOTOR_ANIMATED_ATTRIBUTE = "IsMotorAnimated";
|
|
12
|
-
RETURN_SPRING_SPEED_ATTRIBUTE = "RagdollSpringReturnSpeed";
|
|
13
|
-
FRICTION_TORQUE_ATTRIBUTE = "RagdollFrictionTorque";
|
|
14
|
-
UPPER_ANGLE_ATTRIBUTE = "RagdollUpperAngle";
|
|
15
|
-
TWIST_LOWER_ANGLE_ATTRIBUTE = "RagdollTwistLowerAngle";
|
|
16
|
-
TWIST_UPPER_ANGLE_ATTRIBUTE = "RagdollTwistUpperAngle";
|
|
17
|
-
})
|