@quenty/ik 15.3.0 → 15.4.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 +2 -2
- package/src/Client/IKServiceClient.lua +8 -6
- package/src/Client/Rig/IKRigClient.lua +2 -1
- package/src/Server/IKService.lua +13 -11
- package/src/Server/Rig/IKRig.lua +2 -1
- package/src/Shared/Grip/IKGripUtils.lua +1 -1
- package/src/Shared/Grip/IKLeftGrip.lua +2 -1
- package/src/Shared/Grip/IKRightGrip.lua +2 -1
- package/src/Client/IKBindersClient.lua +0 -18
- package/src/Server/IKBindersServer.lua +0 -19
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.4.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ik@15.3.0...@quenty/ik@15.4.0) (2024-04-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Refactor IK logic ([f83df38](https://github.com/Quenty/NevermoreEngine/commit/f83df385a895eb791b74e2a1be6069c1a094b788))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [15.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ik@15.2.1...@quenty/ik@15.3.0) (2024-04-27)
|
|
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.
|
|
3
|
+
"version": "15.4.0",
|
|
4
4
|
"description": "Inverse Kinematics for characters on Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "1f65df4adb6f3c04fb25d70bfa93f0f7c332c143"
|
|
60
60
|
}
|
|
@@ -51,7 +51,9 @@ function IKServiceClient:Init(serviceBag)
|
|
|
51
51
|
self._serviceBag:GetService(require("Motor6DServiceClient"))
|
|
52
52
|
|
|
53
53
|
-- Internal
|
|
54
|
-
self.
|
|
54
|
+
self._ikRigBinderClient = self._serviceBag:GetService(require("IKRigClient"))
|
|
55
|
+
self._serviceBag:GetService(require("IKRightGrip"))
|
|
56
|
+
self._serviceBag:GetService(require("IKLeftGrip"))
|
|
55
57
|
end
|
|
56
58
|
|
|
57
59
|
--[=[
|
|
@@ -74,7 +76,7 @@ function IKServiceClient:GetRig(humanoid)
|
|
|
74
76
|
assert(self._serviceBag, "Not initialized")
|
|
75
77
|
assert(typeof(humanoid) == "Instance" and humanoid:IsA("Humanoid"), "Bad humanoid")
|
|
76
78
|
|
|
77
|
-
return self.
|
|
79
|
+
return self._ikRigBinderClient:Get(humanoid)
|
|
78
80
|
end
|
|
79
81
|
|
|
80
82
|
--[=[
|
|
@@ -86,7 +88,7 @@ function IKServiceClient:PromiseRig(humanoid)
|
|
|
86
88
|
assert(self._serviceBag, "Not initialized")
|
|
87
89
|
assert(typeof(humanoid) == "Instance" and humanoid:IsA("Humanoid"), "Bad humanoid")
|
|
88
90
|
|
|
89
|
-
return self.
|
|
91
|
+
return self._ikRigBinderClient:Promise(humanoid)
|
|
90
92
|
end
|
|
91
93
|
|
|
92
94
|
--[=[
|
|
@@ -163,9 +165,9 @@ end
|
|
|
163
165
|
]=]
|
|
164
166
|
function IKServiceClient:GetLocalPlayerRig()
|
|
165
167
|
assert(self._serviceBag, "Not initialized")
|
|
166
|
-
assert(self.
|
|
168
|
+
assert(self._ikRigBinderClient, "Not initialize")
|
|
167
169
|
|
|
168
|
-
return IKRigUtils.getPlayerIKRig(self.
|
|
170
|
+
return IKRigUtils.getPlayerIKRig(self._ikRigBinderClient, Players.LocalPlayer)
|
|
169
171
|
end
|
|
170
172
|
|
|
171
173
|
function IKServiceClient:_updateStepped()
|
|
@@ -179,7 +181,7 @@ function IKServiceClient:_updateStepped()
|
|
|
179
181
|
|
|
180
182
|
local camPosition = Workspace.CurrentCamera.CFrame.p
|
|
181
183
|
|
|
182
|
-
for _, rig in pairs(self.
|
|
184
|
+
for _, rig in pairs(self._ikRigBinderClient:GetAll()) do
|
|
183
185
|
debug.profilebegin("RigUpdate")
|
|
184
186
|
|
|
185
187
|
local position = rig:GetPositionOrNil()
|
|
@@ -10,6 +10,7 @@ local Players = game:GetService("Players")
|
|
|
10
10
|
local IKRigBase = require("IKRigBase")
|
|
11
11
|
local IKConstants = require("IKConstants")
|
|
12
12
|
local IKRigAimerLocalPlayer = require("IKRigAimerLocalPlayer")
|
|
13
|
+
local Binder = require("Binder")
|
|
13
14
|
|
|
14
15
|
local IKRigClient = setmetatable({}, IKRigBase)
|
|
15
16
|
IKRigClient.ClassName = "IKRigClient"
|
|
@@ -95,4 +96,4 @@ function IKRigClient:_setupLocalPlayer(remoteEvent)
|
|
|
95
96
|
self._maid:GiveTask(self._localPlayerAimer)
|
|
96
97
|
end
|
|
97
98
|
|
|
98
|
-
return IKRigClient
|
|
99
|
+
return Binder.new("IKRig", IKRigClient)
|
package/src/Server/IKService.lua
CHANGED
|
@@ -52,8 +52,10 @@ function IKService:Init(serviceBag)
|
|
|
52
52
|
self._serviceBag:GetService(require("Motor6DService"))
|
|
53
53
|
self._humanoidTrackerService = self._serviceBag:GetService(require("HumanoidTrackerService"))
|
|
54
54
|
|
|
55
|
-
--
|
|
56
|
-
self.
|
|
55
|
+
-- Binders
|
|
56
|
+
self._ikRigBinder = self._serviceBag:GetService(require("IKRig"))
|
|
57
|
+
self._serviceBag:GetService(require("IKRightGrip"))
|
|
58
|
+
self._serviceBag:GetService(require("IKLeftGrip"))
|
|
57
59
|
end
|
|
58
60
|
|
|
59
61
|
--[=[
|
|
@@ -85,7 +87,7 @@ end
|
|
|
85
87
|
@return IKRig?
|
|
86
88
|
]=]
|
|
87
89
|
function IKService:GetRig(humanoid)
|
|
88
|
-
return self.
|
|
90
|
+
return self._ikRigBinder:Bind(humanoid)
|
|
89
91
|
end
|
|
90
92
|
|
|
91
93
|
--[=[
|
|
@@ -96,8 +98,8 @@ end
|
|
|
96
98
|
function IKService:PromiseRig(humanoid)
|
|
97
99
|
assert(typeof(humanoid) == "Instance", "Bad humanoid")
|
|
98
100
|
|
|
99
|
-
self.
|
|
100
|
-
return self.
|
|
101
|
+
self._ikRigBinder:Bind(humanoid)
|
|
102
|
+
return self._ikRigBinder:Promise(humanoid)
|
|
101
103
|
end
|
|
102
104
|
|
|
103
105
|
--[=[
|
|
@@ -107,7 +109,7 @@ end
|
|
|
107
109
|
function IKService:RemoveRig(humanoid)
|
|
108
110
|
assert(typeof(humanoid) == "Instance" and humanoid:IsA("Humanoid"), "Bad humanoid")
|
|
109
111
|
|
|
110
|
-
self.
|
|
112
|
+
self._ikRigBinder:Unbind(humanoid)
|
|
111
113
|
end
|
|
112
114
|
|
|
113
115
|
--[=[
|
|
@@ -127,7 +129,7 @@ function IKService:UpdateServerRigTarget(humanoid, target)
|
|
|
127
129
|
assert(typeof(humanoid) == "Instance" and humanoid:IsA("Humanoid"), "Bad humanoid")
|
|
128
130
|
assert(typeof(target) == "Vector3", "Bad target")
|
|
129
131
|
|
|
130
|
-
local serverRig = self.
|
|
132
|
+
local serverRig = self._ikRigBinder:Bind(humanoid)
|
|
131
133
|
if not serverRig then
|
|
132
134
|
warn("[IKService.UpdateServerRigTarget] - No serverRig")
|
|
133
135
|
return
|
|
@@ -147,15 +149,15 @@ function IKService:_handlePlayer(player)
|
|
|
147
149
|
|
|
148
150
|
maid:GiveTask(humanoidTracker.AliveHumanoid.Changed:Connect(function(new, old)
|
|
149
151
|
if old then
|
|
150
|
-
self.
|
|
152
|
+
self._ikRigBinder:Unbind(old)
|
|
151
153
|
end
|
|
152
154
|
if new then
|
|
153
|
-
self.
|
|
155
|
+
self._ikRigBinder:Bind(new)
|
|
154
156
|
end
|
|
155
157
|
end))
|
|
156
158
|
|
|
157
159
|
if humanoidTracker.AliveHumanoid.Value then
|
|
158
|
-
self.
|
|
160
|
+
self._ikRigBinder:Bind(humanoidTracker.AliveHumanoid.Value)
|
|
159
161
|
end
|
|
160
162
|
|
|
161
163
|
self._maid[player] = maid
|
|
@@ -164,7 +166,7 @@ end
|
|
|
164
166
|
function IKService:_updateStepped()
|
|
165
167
|
debug.profilebegin("IKUpdateServer")
|
|
166
168
|
|
|
167
|
-
for _, rig in pairs(self.
|
|
169
|
+
for _, rig in pairs(self._ikRigBinder:GetAll()) do
|
|
168
170
|
debug.profilebegin("RigUpdateServer")
|
|
169
171
|
|
|
170
172
|
local lastUpdateTime = rig:GetLastUpdateTime()
|
package/src/Server/Rig/IKRig.lua
CHANGED
|
@@ -12,6 +12,7 @@ local IKRigBase = require("IKRigBase")
|
|
|
12
12
|
local IKConstants = require("IKConstants")
|
|
13
13
|
local CharacterUtils = require("CharacterUtils")
|
|
14
14
|
local Motor6DStackHumanoid = require("Motor6DStackHumanoid")
|
|
15
|
+
local Binder = require("Binder")
|
|
15
16
|
|
|
16
17
|
local IKRig = setmetatable({}, IKRigBase)
|
|
17
18
|
IKRig.ClassName = "IKRig"
|
|
@@ -90,4 +91,4 @@ function IKRig:_onServerEvent(player, target)
|
|
|
90
91
|
end
|
|
91
92
|
end
|
|
92
93
|
|
|
93
|
-
return IKRig
|
|
94
|
+
return Binder.new("IKRig", IKRig)
|
|
@@ -10,7 +10,7 @@ local IKGripUtils = {}
|
|
|
10
10
|
|
|
11
11
|
```lua
|
|
12
12
|
-- Get the binder
|
|
13
|
-
local leftGripAttachmentBinder = serviceBag:GetService(require("
|
|
13
|
+
local leftGripAttachmentBinder = serviceBag:GetService(require("IKLeftGrip"))
|
|
14
14
|
|
|
15
15
|
-- Setup sample grip
|
|
16
16
|
local attachment = Instance.new("Attachment")
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
local require = require(script.Parent.loader).load(script)
|
|
7
7
|
|
|
8
8
|
local IKGripBase = require("IKGripBase")
|
|
9
|
+
local Binder = require("Binder")
|
|
9
10
|
|
|
10
11
|
local IKLeftGrip = setmetatable({}, IKGripBase)
|
|
11
12
|
IKLeftGrip.ClassName = "IKLeftGrip"
|
|
@@ -25,4 +26,4 @@ function IKLeftGrip.new(objectValue, serviceBag)
|
|
|
25
26
|
return self
|
|
26
27
|
end
|
|
27
28
|
|
|
28
|
-
return IKLeftGrip
|
|
29
|
+
return Binder.new("IKLeftGrip", IKLeftGrip)
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
local require = require(script.Parent.loader).load(script)
|
|
7
7
|
|
|
8
8
|
local IKGripBase = require("IKGripBase")
|
|
9
|
+
local Binder = require("Binder")
|
|
9
10
|
|
|
10
11
|
local IKRightGrip = setmetatable({}, IKGripBase)
|
|
11
12
|
IKRightGrip.ClassName = "IKRightGrip"
|
|
@@ -25,4 +26,4 @@ function IKRightGrip.new(objectValue, serviceBag)
|
|
|
25
26
|
return self
|
|
26
27
|
end
|
|
27
28
|
|
|
28
|
-
return IKRightGrip
|
|
29
|
+
return Binder.new("IKRightGrip", IKRightGrip)
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
--[=[
|
|
2
|
-
Holds binders
|
|
3
|
-
@class IKBindersClient
|
|
4
|
-
]=]
|
|
5
|
-
|
|
6
|
-
local require = require(script.Parent.loader).load(script)
|
|
7
|
-
|
|
8
|
-
local BinderProvider = require("BinderProvider")
|
|
9
|
-
local Binder = require("Binder")
|
|
10
|
-
|
|
11
|
-
return BinderProvider.new(script.Name, function(self, serviceBag)
|
|
12
|
-
-- Rig
|
|
13
|
-
self:Add(Binder.new("IKRig", require("IKRigClient"), serviceBag))
|
|
14
|
-
|
|
15
|
-
-- Grips
|
|
16
|
-
self:Add(Binder.new("IKRightGrip", require("IKRightGrip"), serviceBag))
|
|
17
|
-
self:Add(Binder.new("IKLeftGrip", require("IKLeftGrip"), serviceBag))
|
|
18
|
-
end)
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
--[=[
|
|
2
|
-
Holds binders
|
|
3
|
-
@server
|
|
4
|
-
@class IKBindersServer
|
|
5
|
-
]=]
|
|
6
|
-
|
|
7
|
-
local require = require(script.Parent.loader).load(script)
|
|
8
|
-
|
|
9
|
-
local BinderProvider = require("BinderProvider")
|
|
10
|
-
local Binder = require("Binder")
|
|
11
|
-
|
|
12
|
-
return BinderProvider.new(script.Name, function(self, serviceBag)
|
|
13
|
-
-- Rig
|
|
14
|
-
self:Add(Binder.new("IKRig", require("IKRig"), serviceBag))
|
|
15
|
-
|
|
16
|
-
-- Grips
|
|
17
|
-
self:Add(Binder.new("IKRightGrip", require("IKRightGrip"), serviceBag))
|
|
18
|
-
self:Add(Binder.new("IKLeftGrip", require("IKLeftGrip"), serviceBag))
|
|
19
|
-
end)
|