@quenty/ik 15.24.0 → 15.24.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 +27 -27
- package/src/Client/IKServiceClient.lua +3 -2
- package/src/Client/Rig/IKRigAimerLocalPlayer.lua +6 -6
- package/src/Client/Rig/IKRigClient.lua +5 -5
- package/src/Server/IKService.lua +4 -3
- package/src/Server/Rig/IKRig.lua +3 -3
- package/src/Shared/Arm/ArmIKBase.lua +11 -11
- package/src/Shared/Grip/IKGripBase.lua +5 -5
- package/src/Shared/Grip/IKRightGrip.lua +1 -1
- package/src/Shared/IKDataService.lua +2 -1
- package/src/Shared/Resources/IKResource.lua +8 -8
- package/src/Shared/Rig/IKRigBase.lua +2 -2
- package/test/scripts/Client/ClientMain.client.lua +1 -1
- package/test/scripts/Server/ServerMain.server.lua +10 -11
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
|
+
## [15.24.1-canary.545.2374fb2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ik@15.24.0...@quenty/ik@15.24.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
|
# [15.24.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ik@15.23.3...@quenty/ik@15.24.0) (2025-04-02)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @quenty/ik
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/ik",
|
|
3
|
-
"version": "15.24.0",
|
|
3
|
+
"version": "15.24.1-canary.545.2374fb2.0",
|
|
4
4
|
"description": "Inverse Kinematics for characters on Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -26,36 +26,36 @@
|
|
|
26
26
|
"Quenty"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@quenty/acceltween": "
|
|
30
|
-
"@quenty/baseobject": "
|
|
31
|
-
"@quenty/binder": "
|
|
32
|
-
"@quenty/brio": "
|
|
33
|
-
"@quenty/camera": "
|
|
34
|
-
"@quenty/characterutils": "
|
|
35
|
-
"@quenty/humanoidtracker": "
|
|
36
|
-
"@quenty/instanceutils": "
|
|
37
|
-
"@quenty/loader": "
|
|
38
|
-
"@quenty/maid": "
|
|
39
|
-
"@quenty/math": "
|
|
40
|
-
"@quenty/motor6d": "
|
|
41
|
-
"@quenty/optional": "
|
|
42
|
-
"@quenty/promise": "
|
|
43
|
-
"@quenty/qframe": "
|
|
44
|
-
"@quenty/r15utils": "
|
|
45
|
-
"@quenty/ragdoll": "
|
|
46
|
-
"@quenty/remoting": "
|
|
47
|
-
"@quenty/rx": "
|
|
48
|
-
"@quenty/servicebag": "
|
|
49
|
-
"@quenty/signal": "
|
|
50
|
-
"@quenty/table": "
|
|
51
|
-
"@quenty/tie": "
|
|
52
|
-
"@quenty/valueobject": "
|
|
29
|
+
"@quenty/acceltween": "2.5.1-canary.545.2374fb2.0",
|
|
30
|
+
"@quenty/baseobject": "10.8.1-canary.545.2374fb2.0",
|
|
31
|
+
"@quenty/binder": "14.19.1-canary.545.2374fb2.0",
|
|
32
|
+
"@quenty/brio": "14.17.1-canary.545.2374fb2.0",
|
|
33
|
+
"@quenty/camera": "14.20.1-canary.545.2374fb2.0",
|
|
34
|
+
"@quenty/characterutils": "12.18.1-canary.545.2374fb2.0",
|
|
35
|
+
"@quenty/humanoidtracker": "13.17.1-canary.545.2374fb2.0",
|
|
36
|
+
"@quenty/instanceutils": "13.17.1-canary.545.2374fb2.0",
|
|
37
|
+
"@quenty/loader": "10.8.1-canary.545.2374fb2.0",
|
|
38
|
+
"@quenty/maid": "3.4.1-canary.545.2374fb2.0",
|
|
39
|
+
"@quenty/math": "2.7.2-canary.545.2374fb2.0",
|
|
40
|
+
"@quenty/motor6d": "7.20.1-canary.545.2374fb2.0",
|
|
41
|
+
"@quenty/optional": "11.8.1-canary.545.2374fb2.0",
|
|
42
|
+
"@quenty/promise": "10.10.2-canary.545.2374fb2.0",
|
|
43
|
+
"@quenty/qframe": "10.10.2-canary.545.2374fb2.0",
|
|
44
|
+
"@quenty/r15utils": "13.17.1-canary.545.2374fb2.0",
|
|
45
|
+
"@quenty/ragdoll": "15.23.1-canary.545.2374fb2.0",
|
|
46
|
+
"@quenty/remoting": "12.18.1-canary.545.2374fb2.0",
|
|
47
|
+
"@quenty/rx": "13.17.1-canary.545.2374fb2.0",
|
|
48
|
+
"@quenty/servicebag": "11.11.2-canary.545.2374fb2.0",
|
|
49
|
+
"@quenty/signal": "7.10.1-canary.545.2374fb2.0",
|
|
50
|
+
"@quenty/table": "3.7.2-canary.545.2374fb2.0",
|
|
51
|
+
"@quenty/tie": "10.20.1-canary.545.2374fb2.0",
|
|
52
|
+
"@quenty/valueobject": "13.17.1-canary.545.2374fb2.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@quenty/rigbuilderutils": "
|
|
55
|
+
"@quenty/rigbuilderutils": "10.19.1-canary.545.2374fb2.0"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "2374fb2b043cfbe0e9b507b3316eec46a4e353a0"
|
|
61
61
|
}
|
|
@@ -18,6 +18,7 @@ local Players = game:GetService("Players")
|
|
|
18
18
|
|
|
19
19
|
local IKRigUtils = require("IKRigUtils")
|
|
20
20
|
local Maid = require("Maid")
|
|
21
|
+
local _ServiceBag = require("ServiceBag")
|
|
21
22
|
|
|
22
23
|
local IKServiceClient = {}
|
|
23
24
|
IKServiceClient.ServiceName = "IKServiceClient"
|
|
@@ -38,7 +39,7 @@ IKServiceClient.ServiceName = "IKServiceClient"
|
|
|
38
39
|
|
|
39
40
|
@param serviceBag ServiceBag
|
|
40
41
|
]=]
|
|
41
|
-
function IKServiceClient:Init(serviceBag)
|
|
42
|
+
function IKServiceClient:Init(serviceBag: _ServiceBag.ServiceBag)
|
|
42
43
|
assert(not self._serviceBag, "Already initialized")
|
|
43
44
|
|
|
44
45
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
@@ -185,7 +186,7 @@ function IKServiceClient:_updateStepped()
|
|
|
185
186
|
|
|
186
187
|
local camPosition = Workspace.CurrentCamera.CFrame.p
|
|
187
188
|
|
|
188
|
-
for _, rig in
|
|
189
|
+
for _, rig in self._ikRigBinderClient:GetAll() do
|
|
189
190
|
debug.profilebegin("RigUpdate")
|
|
190
191
|
|
|
191
192
|
local position = rig:GetPositionOrNil()
|
|
@@ -49,7 +49,7 @@ end
|
|
|
49
49
|
Sets whether the local player should look around automatically.
|
|
50
50
|
@param lookAround boolean
|
|
51
51
|
]=]
|
|
52
|
-
function IKRigAimerLocalPlayer:SetLookAround(lookAround)
|
|
52
|
+
function IKRigAimerLocalPlayer:SetLookAround(lookAround: boolean)
|
|
53
53
|
assert(type(lookAround) == "boolean", "Bad lookAround")
|
|
54
54
|
|
|
55
55
|
self._lookAround = lookAround
|
|
@@ -71,13 +71,13 @@ function IKRigAimerLocalPlayer:SetAimPosition(position, optionalPriority)
|
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
self._aimData = {
|
|
74
|
-
priority = optionalPriority
|
|
75
|
-
position = position
|
|
76
|
-
timeStamp = os.clock()
|
|
74
|
+
priority = optionalPriority,
|
|
75
|
+
position = position, -- May be nil
|
|
76
|
+
timeStamp = os.clock(),
|
|
77
77
|
}
|
|
78
78
|
end
|
|
79
79
|
|
|
80
|
-
function IKRigAimerLocalPlayer:PushReplicationRate(replicateRate)
|
|
80
|
+
function IKRigAimerLocalPlayer:PushReplicationRate(replicateRate: number)
|
|
81
81
|
assert(type(replicateRate) == "number", "Bad replicateRate")
|
|
82
82
|
|
|
83
83
|
local data = {
|
|
@@ -102,7 +102,7 @@ end
|
|
|
102
102
|
|
|
103
103
|
function IKRigAimerLocalPlayer:_updateReplicationRate()
|
|
104
104
|
local best = nil
|
|
105
|
-
for _, rateData in
|
|
105
|
+
for _, rateData in self._replicationRates do
|
|
106
106
|
local rate = rateData.replicateRate
|
|
107
107
|
if not best or rate < best then
|
|
108
108
|
best = rate
|
|
@@ -17,7 +17,7 @@ local IKRigClient = setmetatable({}, IKRigBase)
|
|
|
17
17
|
IKRigClient.ClassName = "IKRigClient"
|
|
18
18
|
IKRigClient.__index = IKRigClient
|
|
19
19
|
|
|
20
|
-
function IKRigClient.new(humanoid, serviceBag)
|
|
20
|
+
function IKRigClient.new(humanoid: Humanoid, serviceBag)
|
|
21
21
|
local self = setmetatable(IKRigBase.new(humanoid, serviceBag), IKRigClient)
|
|
22
22
|
|
|
23
23
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
@@ -38,7 +38,7 @@ end
|
|
|
38
38
|
|
|
39
39
|
@return Vector3?
|
|
40
40
|
]=]
|
|
41
|
-
function IKRigClient:GetPositionOrNil()
|
|
41
|
+
function IKRigClient:GetPositionOrNil(): Vector3?
|
|
42
42
|
local rootPart = self._obj.RootPart
|
|
43
43
|
if not rootPart then
|
|
44
44
|
return nil
|
|
@@ -61,7 +61,7 @@ end
|
|
|
61
61
|
|
|
62
62
|
@return Vector3?
|
|
63
63
|
]=]
|
|
64
|
-
function IKRigClient:GetAimPosition()
|
|
64
|
+
function IKRigClient:GetAimPosition(): Vector3?
|
|
65
65
|
if self._localPlayerAimer then
|
|
66
66
|
return self._localPlayerAimer:GetAimPosition()
|
|
67
67
|
end
|
|
@@ -69,7 +69,7 @@ function IKRigClient:GetAimPosition()
|
|
|
69
69
|
return self._target
|
|
70
70
|
end
|
|
71
71
|
|
|
72
|
-
function IKRigClient:_setAimPosition(newTarget)
|
|
72
|
+
function IKRigClient:_setAimPosition(newTarget: Vector3?)
|
|
73
73
|
assert(typeof(newTarget) == "Vector3" or newTarget == nil, "Bad newTarget")
|
|
74
74
|
|
|
75
75
|
local torso = self:GetTorso()
|
|
@@ -93,7 +93,7 @@ function IKRigClient:_setupLocalPlayer()
|
|
|
93
93
|
self._localPlayerAimer = self._maid:Add(IKRigAimerLocalPlayer.new(self._serviceBag, self))
|
|
94
94
|
end
|
|
95
95
|
|
|
96
|
-
function IKRigClient:FireSetAimPosition(newTarget)
|
|
96
|
+
function IKRigClient:FireSetAimPosition(newTarget: Vector3?)
|
|
97
97
|
assert(self:GetPlayer() == Players.LocalPlayer, "Canot only fire from client")
|
|
98
98
|
|
|
99
99
|
self._remoting.SetAimPosition:FireServer(newTarget)
|
package/src/Server/IKService.lua
CHANGED
|
@@ -23,6 +23,7 @@ local Players = game:GetService("Players")
|
|
|
23
23
|
local RunService = game:GetService("RunService")
|
|
24
24
|
|
|
25
25
|
local Maid = require("Maid")
|
|
26
|
+
local _ServiceBag = require("ServiceBag")
|
|
26
27
|
|
|
27
28
|
local SERVER_UPDATE_RATE = 1 / 10
|
|
28
29
|
|
|
@@ -42,7 +43,7 @@ IKService.ServiceName = "IKService"
|
|
|
42
43
|
|
|
43
44
|
@param serviceBag ServiceBag
|
|
44
45
|
]=]
|
|
45
|
-
function IKService:Init(serviceBag)
|
|
46
|
+
function IKService:Init(serviceBag: _ServiceBag.ServiceBag)
|
|
46
47
|
assert(not self._maid, "Already initialized")
|
|
47
48
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
48
49
|
self._maid = Maid.new()
|
|
@@ -75,7 +76,7 @@ function IKService:Start()
|
|
|
75
76
|
self:_handlePlayerRemoving(player)
|
|
76
77
|
end))
|
|
77
78
|
|
|
78
|
-
for _, player in
|
|
79
|
+
for _, player in Players:GetPlayers() do
|
|
79
80
|
self:_handlePlayer(player)
|
|
80
81
|
end
|
|
81
82
|
|
|
@@ -171,7 +172,7 @@ end
|
|
|
171
172
|
function IKService:_updateStepped()
|
|
172
173
|
debug.profilebegin("IKUpdateServer")
|
|
173
174
|
|
|
174
|
-
for _, rig in
|
|
175
|
+
for _, rig in self._ikRigBinder:GetAll() do
|
|
175
176
|
debug.profilebegin("RigUpdateServer")
|
|
176
177
|
|
|
177
178
|
local lastUpdateTime = rig:GetLastUpdateTime()
|
package/src/Server/Rig/IKRig.lua
CHANGED
|
@@ -16,7 +16,7 @@ local IKRig = setmetatable({}, IKRigBase)
|
|
|
16
16
|
IKRig.ClassName = "IKRig"
|
|
17
17
|
IKRig.__index = IKRig
|
|
18
18
|
|
|
19
|
-
function IKRig.new(humanoid, serviceBag)
|
|
19
|
+
function IKRig.new(humanoid: Humanoid, serviceBag)
|
|
20
20
|
local self = setmetatable(IKRigBase.new(humanoid, serviceBag), IKRig)
|
|
21
21
|
|
|
22
22
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
@@ -44,7 +44,7 @@ end
|
|
|
44
44
|
|
|
45
45
|
@param target Vector3?
|
|
46
46
|
]=]
|
|
47
|
-
function IKRig:SetAimPosition(target)
|
|
47
|
+
function IKRig:SetAimPosition(target: Vector3?)
|
|
48
48
|
assert(typeof(target) == "Vector3" or target == nil, "Bad target")
|
|
49
49
|
|
|
50
50
|
self:_applyAimPosition(target)
|
|
@@ -62,7 +62,7 @@ function IKRig:_setupRemoting()
|
|
|
62
62
|
end))
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
-
function IKRig:_applyAimPosition(target)
|
|
65
|
+
function IKRig:_applyAimPosition(target: Vector3?)
|
|
66
66
|
assert(typeof(target) == "Vector3" or target == nil, "Bad target")
|
|
67
67
|
|
|
68
68
|
-- Guard against NaN
|
|
@@ -159,35 +159,35 @@ function ArmIKBase:_observeStateBrio()
|
|
|
159
159
|
RxBrioUtils.switchMapBrio(function(character)
|
|
160
160
|
local observeUpperTorsoBrio = RxInstanceUtils.observeLastNamedChildBrio(character, "BasePart", "UpperTorso"):Pipe({
|
|
161
161
|
Rx.shareReplay(1);
|
|
162
|
-
})
|
|
162
|
+
})
|
|
163
163
|
local observeUpperArmBrio = RxInstanceUtils.observeLastNamedChildBrio(character, "BasePart", self._armName .. "UpperArm"):Pipe({
|
|
164
164
|
Rx.shareReplay(1);
|
|
165
|
-
})
|
|
165
|
+
})
|
|
166
166
|
local observeLowerArmBrio = RxInstanceUtils.observeLastNamedChildBrio(character, "BasePart", self._armName .. "LowerArm"):Pipe({
|
|
167
167
|
Rx.shareReplay(1);
|
|
168
|
-
})
|
|
168
|
+
})
|
|
169
169
|
local observeHandBrio = RxInstanceUtils.observeLastNamedChildBrio(character, "BasePart", self._armName .. "Hand"):Pipe({
|
|
170
170
|
Rx.shareReplay(1);
|
|
171
|
-
})
|
|
171
|
+
})
|
|
172
172
|
|
|
173
173
|
local observeShoulderBrio = observeUpperArmBrio:Pipe({
|
|
174
174
|
RxBrioUtils.switchMapBrio(function(upperArm)
|
|
175
175
|
return RxInstanceUtils.observeLastNamedChildBrio(upperArm, "Motor6D", self._armName .. "Shoulder")
|
|
176
176
|
end);
|
|
177
177
|
Rx.shareReplay(1);
|
|
178
|
-
})
|
|
178
|
+
})
|
|
179
179
|
local observeElbowBrio = observeLowerArmBrio:Pipe({
|
|
180
180
|
RxBrioUtils.switchMapBrio(function(lowerArm)
|
|
181
181
|
return RxInstanceUtils.observeLastNamedChildBrio(lowerArm, "Motor6D", self._armName .. "Elbow")
|
|
182
182
|
end);
|
|
183
183
|
Rx.shareReplay(1);
|
|
184
|
-
})
|
|
184
|
+
})
|
|
185
185
|
local observeWristBrio = observeHandBrio:Pipe({
|
|
186
186
|
RxBrioUtils.switchMapBrio(function(hand)
|
|
187
187
|
return RxInstanceUtils.observeLastNamedChildBrio(hand, "Motor6D", self._armName .. "Wrist")
|
|
188
188
|
end);
|
|
189
189
|
Rx.shareReplay(1);
|
|
190
|
-
})
|
|
190
|
+
})
|
|
191
191
|
|
|
192
192
|
return RxBrioUtils.flatCombineLatest({
|
|
193
193
|
UpperTorso = observeUpperTorsoBrio;
|
|
@@ -201,19 +201,19 @@ function ArmIKBase:_observeStateBrio()
|
|
|
201
201
|
|
|
202
202
|
ShoulderMotor6DStack = observeShoulderBrio:Pipe({
|
|
203
203
|
RxBrioUtils.switchMapBrio(function(motor)
|
|
204
|
-
return Motor6DStackInterface:ObserveLastImplementationBrio(motor, self._tieRealmService:GetTieRealm())
|
|
204
|
+
return Motor6DStackInterface:ObserveLastImplementationBrio(motor, self._tieRealmService:GetTieRealm())
|
|
205
205
|
end);
|
|
206
206
|
Rx.defaultsToNil;
|
|
207
207
|
});
|
|
208
208
|
ElbowMotor6DStack = observeElbowBrio:Pipe({
|
|
209
209
|
RxBrioUtils.switchMapBrio(function(motor)
|
|
210
|
-
return Motor6DStackInterface:ObserveLastImplementationBrio(motor, self._tieRealmService:GetTieRealm())
|
|
210
|
+
return Motor6DStackInterface:ObserveLastImplementationBrio(motor, self._tieRealmService:GetTieRealm())
|
|
211
211
|
end);
|
|
212
212
|
Rx.defaultsToNil;
|
|
213
213
|
});
|
|
214
214
|
WristMotor6DStack = observeWristBrio:Pipe({
|
|
215
215
|
RxBrioUtils.switchMapBrio(function(motor)
|
|
216
|
-
return Motor6DStackInterface:ObserveLastImplementationBrio(motor, self._tieRealmService:GetTieRealm())
|
|
216
|
+
return Motor6DStackInterface:ObserveLastImplementationBrio(motor, self._tieRealmService:GetTieRealm())
|
|
217
217
|
end);
|
|
218
218
|
Rx.defaultsToNil;
|
|
219
219
|
});
|
|
@@ -287,7 +287,7 @@ function ArmIKBase:Grip(attachment, priority)
|
|
|
287
287
|
end
|
|
288
288
|
|
|
289
289
|
function ArmIKBase:_stopGrip(grip)
|
|
290
|
-
for index, value in
|
|
290
|
+
for index, value in self._grips do
|
|
291
291
|
if value == grip then
|
|
292
292
|
table.remove(self._grips, index)
|
|
293
293
|
break
|
|
@@ -15,7 +15,7 @@ local IKGripBase = setmetatable({}, BaseObject)
|
|
|
15
15
|
IKGripBase.ClassName = "IKGripBase"
|
|
16
16
|
IKGripBase.__index = IKGripBase
|
|
17
17
|
|
|
18
|
-
function IKGripBase.new(objectValue, serviceBag)
|
|
18
|
+
function IKGripBase.new(objectValue: ObjectValue, serviceBag)
|
|
19
19
|
local self = setmetatable(BaseObject.new(objectValue), IKGripBase)
|
|
20
20
|
|
|
21
21
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
@@ -27,11 +27,11 @@ function IKGripBase.new(objectValue, serviceBag)
|
|
|
27
27
|
return self
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
function IKGripBase:GetPriority()
|
|
30
|
+
function IKGripBase:GetPriority(): number
|
|
31
31
|
return 1
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
function IKGripBase:GetAttachment()
|
|
34
|
+
function IKGripBase:GetAttachment(): Attachment?
|
|
35
35
|
return self._obj.Parent
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -42,9 +42,9 @@ function IKGripBase:PromiseIKRig()
|
|
|
42
42
|
|
|
43
43
|
local ikService
|
|
44
44
|
if RunService:IsServer() then
|
|
45
|
-
ikService = self._serviceBag:GetService(require("IKService"))
|
|
45
|
+
ikService = self._serviceBag:GetService((require :: any)("IKService"))
|
|
46
46
|
else
|
|
47
|
-
ikService = self._serviceBag:GetService(require("IKServiceClient"))
|
|
47
|
+
ikService = self._serviceBag:GetService((require :: any)("IKServiceClient"))
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
local promise = promisePropertyValue(self._obj, "Value")
|
|
@@ -12,7 +12,7 @@ local IKRightGrip = setmetatable({}, IKGripBase)
|
|
|
12
12
|
IKRightGrip.ClassName = "IKRightGrip"
|
|
13
13
|
IKRightGrip.__index = IKRightGrip
|
|
14
14
|
|
|
15
|
-
function IKRightGrip.new(objectValue, serviceBag)
|
|
15
|
+
function IKRightGrip.new(objectValue: ObjectValue, serviceBag)
|
|
16
16
|
local self = setmetatable(IKGripBase.new(objectValue, serviceBag), IKRightGrip)
|
|
17
17
|
|
|
18
18
|
self:PromiseIKRig()
|
|
@@ -6,11 +6,12 @@ local require = require(script.Parent.loader).load(script)
|
|
|
6
6
|
|
|
7
7
|
local IKRigInterface = require("IKRigInterface")
|
|
8
8
|
local TieRealmService = require("TieRealmService")
|
|
9
|
+
local _ServiceBag = require("ServiceBag")
|
|
9
10
|
|
|
10
11
|
local IKDataService = {}
|
|
11
12
|
IKDataService.ServiceName = "IKDataService"
|
|
12
13
|
|
|
13
|
-
function IKDataService:Init(serviceBag)
|
|
14
|
+
function IKDataService:Init(serviceBag: _ServiceBag.ServiceBag)
|
|
14
15
|
assert(not self._serviceBag, "Already initialized")
|
|
15
16
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
16
17
|
|
|
@@ -30,7 +30,7 @@ function IKResource.new(data)
|
|
|
30
30
|
self.ReadyChanged = self._ready.Changed
|
|
31
31
|
|
|
32
32
|
if self._data.children then
|
|
33
|
-
for _, childData in
|
|
33
|
+
for _, childData in self._data.children do
|
|
34
34
|
self:_addResource(IKResource.new(childData))
|
|
35
35
|
end
|
|
36
36
|
end
|
|
@@ -42,11 +42,11 @@ function IKResource:GetData()
|
|
|
42
42
|
return self._data
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
function IKResource:IsReady()
|
|
45
|
+
function IKResource:IsReady(): boolean
|
|
46
46
|
return self._ready.Value
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
function IKResource:Get(descendantName)
|
|
49
|
+
function IKResource:Get(descendantName: string)
|
|
50
50
|
local resource = self._descendantLookupMap[descendantName]
|
|
51
51
|
if not resource then
|
|
52
52
|
error(string.format("[IKResource.Get] - Resource %q does not exist", tostring(descendantName)))
|
|
@@ -60,7 +60,7 @@ function IKResource:Get(descendantName)
|
|
|
60
60
|
return result
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
-
function IKResource:GetInstance()
|
|
63
|
+
function IKResource:GetInstance(): Instance?
|
|
64
64
|
if self._data.isLink then
|
|
65
65
|
if self._instance then
|
|
66
66
|
return self._instance.Value
|
|
@@ -72,7 +72,7 @@ function IKResource:GetInstance()
|
|
|
72
72
|
return self._instance
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
-
function IKResource:SetInstance(instance)
|
|
75
|
+
function IKResource:SetInstance(instance: Instance?)
|
|
76
76
|
if self._instance == instance then
|
|
77
77
|
return
|
|
78
78
|
end
|
|
@@ -107,7 +107,7 @@ function IKResource:GetLookupTable()
|
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
function IKResource:_startListening(maid, instance)
|
|
110
|
-
for _, child in
|
|
110
|
+
for _, child in instance:GetChildren() do
|
|
111
111
|
self:_handleChildAdded(child)
|
|
112
112
|
end
|
|
113
113
|
|
|
@@ -165,7 +165,7 @@ function IKResource:_handleChildRemoved(child)
|
|
|
165
165
|
end
|
|
166
166
|
|
|
167
167
|
function IKResource:_clearChildren()
|
|
168
|
-
for _, child in
|
|
168
|
+
for _, child in self._childResourceMap do
|
|
169
169
|
child:SetInstance(nil)
|
|
170
170
|
end
|
|
171
171
|
end
|
|
@@ -185,7 +185,7 @@ function IKResource:_calculateIsReady()
|
|
|
185
185
|
end
|
|
186
186
|
end
|
|
187
187
|
|
|
188
|
-
for _, child in
|
|
188
|
+
for _, child in self._childResourceMap do
|
|
189
189
|
if not child:IsReady() then
|
|
190
190
|
return false
|
|
191
191
|
end
|
|
@@ -46,13 +46,13 @@ function IKRigBase:Update()
|
|
|
46
46
|
self._lastUpdateTime = tick()
|
|
47
47
|
self.Updating:Fire()
|
|
48
48
|
|
|
49
|
-
for _, item in
|
|
49
|
+
for _, item in self._ikTargets do
|
|
50
50
|
item:Update()
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
function IKRigBase:UpdateTransformOnly()
|
|
55
|
-
for _, item in
|
|
55
|
+
for _, item in self._ikTargets do
|
|
56
56
|
item:UpdateTransformOnly()
|
|
57
57
|
end
|
|
58
58
|
end
|
|
@@ -15,17 +15,16 @@ serviceBag:Start()
|
|
|
15
15
|
|
|
16
16
|
-- Build test NPC rigs
|
|
17
17
|
local RigBuilderUtils = require("RigBuilderUtils")
|
|
18
|
-
RigBuilderUtils.promiseR15MeshRig()
|
|
19
|
-
|
|
20
|
-
local humanoid = character.Humanoid
|
|
18
|
+
RigBuilderUtils.promiseR15MeshRig():Then(function(character)
|
|
19
|
+
local humanoid = character.Humanoid
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
-- reparent to middle
|
|
22
|
+
humanoid.RootPart.CFrame = CFrame.new(0, 25, 0)
|
|
23
|
+
character.Parent = workspace
|
|
24
|
+
humanoid.RootPart.CFrame = CFrame.new(0, 25, 0)
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
end)
|
|
26
|
+
-- look at origin
|
|
27
|
+
RunService.Stepped:Connect(function()
|
|
28
|
+
ikService:UpdateServerRigTarget(humanoid, Vector3.zero)
|
|
31
29
|
end)
|
|
30
|
+
end)
|