@quenty/ik 15.22.0 → 15.23.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 +8 -0
- package/package.json +23 -23
- package/src/Client/IKServiceClient.lua +3 -0
- package/src/Client/Rig/IKRigAimerLocalPlayer.lua +2 -13
- package/src/Client/Rig/IKRigClient.lua +26 -22
- package/src/Server/IKService.lua +4 -1
- package/src/Server/Rig/IKRig.lua +23 -36
- package/src/Shared/IKDataService.lua +32 -0
- package/src/Shared/Interfaces/IKRigInterface.lua +19 -0
- package/src/Shared/Torso/TorsoIKBase.lua +1 -1
- package/src/Shared/IKConstants.lua +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.23.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ik@15.22.0...@quenty/ik@15.23.0) (2025-02-18)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/ik
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [15.22.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ik@15.21.2...@quenty/ik@15.22.0) (2025-01-24)
|
|
7
15
|
|
|
8
16
|
**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.23.0",
|
|
4
4
|
"description": "Inverse Kinematics for characters on Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -27,35 +27,35 @@
|
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@quenty/acceltween": "^2.5.0",
|
|
30
|
-
"@quenty/baseobject": "^10.
|
|
31
|
-
"@quenty/binder": "^14.
|
|
32
|
-
"@quenty/brio": "^14.
|
|
33
|
-
"@quenty/camera": "^14.
|
|
34
|
-
"@quenty/characterutils": "^12.
|
|
35
|
-
"@quenty/humanoidtracker": "^13.
|
|
36
|
-
"@quenty/instanceutils": "^13.
|
|
37
|
-
"@quenty/loader": "^10.
|
|
30
|
+
"@quenty/baseobject": "^10.8.0",
|
|
31
|
+
"@quenty/binder": "^14.18.0",
|
|
32
|
+
"@quenty/brio": "^14.16.0",
|
|
33
|
+
"@quenty/camera": "^14.19.0",
|
|
34
|
+
"@quenty/characterutils": "^12.17.0",
|
|
35
|
+
"@quenty/humanoidtracker": "^13.16.0",
|
|
36
|
+
"@quenty/instanceutils": "^13.16.0",
|
|
37
|
+
"@quenty/loader": "^10.8.0",
|
|
38
38
|
"@quenty/maid": "^3.4.0",
|
|
39
39
|
"@quenty/math": "^2.7.0",
|
|
40
|
-
"@quenty/motor6d": "^7.
|
|
41
|
-
"@quenty/optional": "^11.
|
|
42
|
-
"@quenty/promise": "^10.
|
|
43
|
-
"@quenty/qframe": "^10.
|
|
44
|
-
"@quenty/r15utils": "^13.
|
|
45
|
-
"@quenty/ragdoll": "^15.
|
|
46
|
-
"@quenty/remoting": "^12.
|
|
47
|
-
"@quenty/rx": "^13.
|
|
48
|
-
"@quenty/servicebag": "^11.
|
|
49
|
-
"@quenty/signal": "^7.
|
|
40
|
+
"@quenty/motor6d": "^7.19.0",
|
|
41
|
+
"@quenty/optional": "^11.8.0",
|
|
42
|
+
"@quenty/promise": "^10.10.0",
|
|
43
|
+
"@quenty/qframe": "^10.10.0",
|
|
44
|
+
"@quenty/r15utils": "^13.16.0",
|
|
45
|
+
"@quenty/ragdoll": "^15.22.0",
|
|
46
|
+
"@quenty/remoting": "^12.17.0",
|
|
47
|
+
"@quenty/rx": "^13.16.0",
|
|
48
|
+
"@quenty/servicebag": "^11.11.0",
|
|
49
|
+
"@quenty/signal": "^7.10.0",
|
|
50
50
|
"@quenty/table": "^3.7.0",
|
|
51
|
-
"@quenty/tie": "^10.
|
|
52
|
-
"@quenty/valueobject": "^13.
|
|
51
|
+
"@quenty/tie": "^10.19.0",
|
|
52
|
+
"@quenty/valueobject": "^13.16.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@quenty/rigbuilderutils": "^10.
|
|
55
|
+
"@quenty/rigbuilderutils": "^10.18.0"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "184a407d8d7366c39009444c3c9a7023cb176471"
|
|
61
61
|
}
|
|
@@ -52,6 +52,9 @@ function IKServiceClient:Init(serviceBag)
|
|
|
52
52
|
self._serviceBag:GetService(require("Motor6DServiceClient"))
|
|
53
53
|
|
|
54
54
|
-- Internal
|
|
55
|
+
self._serviceBag:GetService(require("IKDataService"))
|
|
56
|
+
|
|
57
|
+
-- Binders
|
|
55
58
|
self._ikRigBinderClient = self._serviceBag:GetService(require("IKRigClient"))
|
|
56
59
|
self._serviceBag:GetService(require("IKRightGrip"))
|
|
57
60
|
self._serviceBag:GetService(require("IKLeftGrip"))
|
|
@@ -45,17 +45,6 @@ function IKRigAimerLocalPlayer.new(serviceBag, ikRig)
|
|
|
45
45
|
return self
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
--[=[
|
|
49
|
-
Sets the remote event for replication
|
|
50
|
-
|
|
51
|
-
@param remoteEvent RemoteEvent
|
|
52
|
-
]=]
|
|
53
|
-
function IKRigAimerLocalPlayer:SetRemoteEvent(remoteEvent)
|
|
54
|
-
assert(not self._remoteEvent, "Already have remoteEvent")
|
|
55
|
-
|
|
56
|
-
self._remoteEvent = assert(remoteEvent, "No remoteEvent")
|
|
57
|
-
end
|
|
58
|
-
|
|
59
48
|
--[=[
|
|
60
49
|
Sets whether the local player should look around automatically.
|
|
61
50
|
@param lookAround boolean
|
|
@@ -178,9 +167,9 @@ function IKRigAimerLocalPlayer:UpdateStepped()
|
|
|
178
167
|
end
|
|
179
168
|
|
|
180
169
|
-- Filter replicate
|
|
181
|
-
if
|
|
170
|
+
if (os.clock() - self._lastReplication) > self._replicationRate then
|
|
182
171
|
self._lastReplication = os.clock()
|
|
183
|
-
self.
|
|
172
|
+
self._ikRig:FireSetAimPosition(aimPosition)
|
|
184
173
|
end
|
|
185
174
|
end
|
|
186
175
|
|
|
@@ -7,37 +7,28 @@ local require = require(script.Parent.loader).load(script)
|
|
|
7
7
|
|
|
8
8
|
local Players = game:GetService("Players")
|
|
9
9
|
|
|
10
|
-
local IKRigBase = require("IKRigBase")
|
|
11
|
-
local IKConstants = require("IKConstants")
|
|
12
|
-
local IKRigAimerLocalPlayer = require("IKRigAimerLocalPlayer")
|
|
13
10
|
local Binder = require("Binder")
|
|
11
|
+
local IKRigAimerLocalPlayer = require("IKRigAimerLocalPlayer")
|
|
12
|
+
local IKRigBase = require("IKRigBase")
|
|
13
|
+
local IKRigInterface = require("IKRigInterface")
|
|
14
|
+
local Remoting = require("Remoting")
|
|
14
15
|
|
|
15
16
|
local IKRigClient = setmetatable({}, IKRigBase)
|
|
16
17
|
IKRigClient.ClassName = "IKRigClient"
|
|
17
18
|
IKRigClient.__index = IKRigClient
|
|
18
19
|
|
|
19
|
-
require("PromiseRemoteEventMixin"):Add(IKRigClient, IKConstants.REMOTE_EVENT_NAME)
|
|
20
|
-
|
|
21
20
|
function IKRigClient.new(humanoid, serviceBag)
|
|
22
21
|
local self = setmetatable(IKRigBase.new(humanoid, serviceBag), IKRigClient)
|
|
23
22
|
|
|
24
23
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
25
24
|
|
|
25
|
+
self:_setupRemoting()
|
|
26
|
+
|
|
26
27
|
if self:GetPlayer() == Players.LocalPlayer then
|
|
27
|
-
self:_setupLocalPlayer(
|
|
28
|
+
self:_setupLocalPlayer()
|
|
28
29
|
end
|
|
29
30
|
|
|
30
|
-
self:
|
|
31
|
-
self._remoteEvent = assert(remoteEvent, "No remoteEvent")
|
|
32
|
-
|
|
33
|
-
self._maid:GiveTask(self._remoteEvent.OnClientEvent:Connect(function(...)
|
|
34
|
-
self:_handleRemoteEventClient(...)
|
|
35
|
-
end))
|
|
36
|
-
|
|
37
|
-
if self._localPlayerAimer then
|
|
38
|
-
self._localPlayerAimer:SetRemoteEvent(self._remoteEvent)
|
|
39
|
-
end
|
|
40
|
-
end)
|
|
31
|
+
self._maid:Add(IKRigInterface.Client:Implement(self._obj, self))
|
|
41
32
|
|
|
42
33
|
return self
|
|
43
34
|
end
|
|
@@ -70,7 +61,7 @@ end
|
|
|
70
61
|
|
|
71
62
|
@return Vector3?
|
|
72
63
|
]=]
|
|
73
|
-
function IKRigClient:
|
|
64
|
+
function IKRigClient:GetAimPosition()
|
|
74
65
|
if self._localPlayerAimer then
|
|
75
66
|
return self._localPlayerAimer:GetAimPosition()
|
|
76
67
|
end
|
|
@@ -78,8 +69,7 @@ function IKRigClient:GetTarget()
|
|
|
78
69
|
return self._target
|
|
79
70
|
end
|
|
80
71
|
|
|
81
|
-
|
|
82
|
-
function IKRigClient:_handleRemoteEventClient(newTarget)
|
|
72
|
+
function IKRigClient:_setAimPosition(newTarget)
|
|
83
73
|
assert(typeof(newTarget) == "Vector3" or newTarget == nil, "Bad newTarget")
|
|
84
74
|
|
|
85
75
|
local torso = self:GetTorso()
|
|
@@ -91,8 +81,22 @@ function IKRigClient:_handleRemoteEventClient(newTarget)
|
|
|
91
81
|
self._target = newTarget
|
|
92
82
|
end
|
|
93
83
|
|
|
94
|
-
function IKRigClient:
|
|
95
|
-
self.
|
|
84
|
+
function IKRigClient:_setupRemoting()
|
|
85
|
+
self._remoting = self._maid:Add(Remoting.Client.new(self._obj, "IKRig"))
|
|
86
|
+
|
|
87
|
+
self._maid:GiveTask(self._remoting.SetAimPosition:Connect(function(...)
|
|
88
|
+
self:_setAimPosition(...)
|
|
89
|
+
end))
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
function IKRigClient:_setupLocalPlayer()
|
|
93
|
+
self._localPlayerAimer = self._maid:Add(IKRigAimerLocalPlayer.new(self._serviceBag, self))
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
function IKRigClient:FireSetAimPosition(newTarget)
|
|
97
|
+
assert(self:GetPlayer() == Players.LocalPlayer, "Canot only fire from client")
|
|
98
|
+
|
|
99
|
+
self._remoting.SetAimPosition:FireServer(newTarget)
|
|
96
100
|
end
|
|
97
101
|
|
|
98
102
|
return Binder.new("IKRig", IKRigClient)
|
package/src/Server/IKService.lua
CHANGED
|
@@ -52,6 +52,9 @@ function IKService:Init(serviceBag)
|
|
|
52
52
|
self._serviceBag:GetService(require("TieRealmService"))
|
|
53
53
|
self._humanoidTrackerService = self._serviceBag:GetService(require("HumanoidTrackerService"))
|
|
54
54
|
|
|
55
|
+
-- Internal
|
|
56
|
+
self._serviceBag:GetService(require("IKDataService"))
|
|
57
|
+
|
|
55
58
|
-- Binders
|
|
56
59
|
self._ikRigBinder = self._serviceBag:GetService(require("IKRig"))
|
|
57
60
|
self._serviceBag:GetService(require("IKRightGrip"))
|
|
@@ -135,7 +138,7 @@ function IKService:UpdateServerRigTarget(humanoid, target)
|
|
|
135
138
|
return
|
|
136
139
|
end
|
|
137
140
|
|
|
138
|
-
serverRig:
|
|
141
|
+
serverRig:SetAimPosition(target)
|
|
139
142
|
end
|
|
140
143
|
|
|
141
144
|
function IKService:_handlePlayerRemoving(player)
|
package/src/Server/Rig/IKRig.lua
CHANGED
|
@@ -6,13 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
local require = require(script.Parent.loader).load(script)
|
|
8
8
|
|
|
9
|
-
local
|
|
10
|
-
|
|
9
|
+
local Binder = require("Binder")
|
|
11
10
|
local IKRigBase = require("IKRigBase")
|
|
12
|
-
local
|
|
13
|
-
local CharacterUtils = require("CharacterUtils")
|
|
11
|
+
local IKRigInterface = require("IKRigInterface")
|
|
14
12
|
local Motor6DStackHumanoid = require("Motor6DStackHumanoid")
|
|
15
|
-
local
|
|
13
|
+
local Remoting = require("Remoting")
|
|
16
14
|
|
|
17
15
|
local IKRig = setmetatable({}, IKRigBase)
|
|
18
16
|
IKRig.ClassName = "IKRig"
|
|
@@ -23,19 +21,11 @@ function IKRig.new(humanoid, serviceBag)
|
|
|
23
21
|
|
|
24
22
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
25
23
|
|
|
26
|
-
self._remoteEvent = Instance.new("RemoteEvent")
|
|
27
|
-
self._remoteEvent.Name = IKConstants.REMOTE_EVENT_NAME
|
|
28
|
-
self._remoteEvent.Archivable = false
|
|
29
|
-
self._remoteEvent.Parent = self._obj
|
|
30
|
-
self._maid:GiveTask(self._remoteEvent)
|
|
31
|
-
|
|
32
|
-
self._maid:GiveTask(self._remoteEvent.OnServerEvent:Connect(function(...)
|
|
33
|
-
self:_onServerEvent(...)
|
|
34
|
-
end))
|
|
35
|
-
|
|
36
24
|
Motor6DStackHumanoid:Tag(self._obj)
|
|
37
25
|
|
|
38
|
-
self
|
|
26
|
+
self:_setupRemoting()
|
|
27
|
+
|
|
28
|
+
self._maid:Add(IKRigInterface.Server:Implement(self._obj, self))
|
|
39
29
|
|
|
40
30
|
return self
|
|
41
31
|
end
|
|
@@ -45,8 +35,8 @@ end
|
|
|
45
35
|
|
|
46
36
|
@return Vector3?
|
|
47
37
|
]=]
|
|
48
|
-
function IKRig:
|
|
49
|
-
return self.
|
|
38
|
+
function IKRig:GetAimPosition()
|
|
39
|
+
return self._aimPosition
|
|
50
40
|
end
|
|
51
41
|
|
|
52
42
|
--[=[
|
|
@@ -54,21 +44,25 @@ end
|
|
|
54
44
|
|
|
55
45
|
@param target Vector3?
|
|
56
46
|
]=]
|
|
57
|
-
function IKRig:
|
|
47
|
+
function IKRig:SetAimPosition(target)
|
|
58
48
|
assert(typeof(target) == "Vector3" or target == nil, "Bad target")
|
|
59
49
|
|
|
60
|
-
self
|
|
50
|
+
self:_applyAimPosition(target)
|
|
51
|
+
self._remoting.SetAimPosition:FireAllClients(target)
|
|
52
|
+
end
|
|
61
53
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
54
|
+
function IKRig:_setupRemoting()
|
|
55
|
+
self._remoting = self._maid:Add(Remoting.Server.new(self._obj, "IKRig"))
|
|
56
|
+
|
|
57
|
+
self._maid:GiveTask(self._remoting.SetAimPosition:Connect(function(player, target)
|
|
58
|
+
assert(player == self:GetPlayer(), "Bad player")
|
|
66
59
|
|
|
67
|
-
|
|
60
|
+
self:_applyAimPosition(target)
|
|
61
|
+
self._remoting.SetAimPosition:FireAllClientsExcept(player, target)
|
|
62
|
+
end))
|
|
68
63
|
end
|
|
69
64
|
|
|
70
|
-
function IKRig:
|
|
71
|
-
assert(player == CharacterUtils.getPlayerFromCharacter(self._obj), "Bad player")
|
|
65
|
+
function IKRig:_applyAimPosition(target)
|
|
72
66
|
assert(typeof(target) == "Vector3" or target == nil, "Bad target")
|
|
73
67
|
|
|
74
68
|
-- Guard against NaN
|
|
@@ -76,18 +70,11 @@ function IKRig:_onServerEvent(player, target)
|
|
|
76
70
|
return
|
|
77
71
|
end
|
|
78
72
|
|
|
79
|
-
self.
|
|
73
|
+
self._aimPosition = target
|
|
80
74
|
|
|
81
75
|
local torso = self:GetTorso()
|
|
82
76
|
if torso then
|
|
83
|
-
torso:Point(self.
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
-- Do replication
|
|
87
|
-
for _, other in pairs(Players:GetPlayers()) do
|
|
88
|
-
if other ~= player then
|
|
89
|
-
self._remoteEvent:FireClient(other, target) -- target may nil
|
|
90
|
-
end
|
|
77
|
+
torso:Point(self._aimPosition)
|
|
91
78
|
end
|
|
92
79
|
end
|
|
93
80
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
--[=[
|
|
2
|
+
@class IKDataService
|
|
3
|
+
]=]
|
|
4
|
+
|
|
5
|
+
local require = require(script.Parent.loader).load(script)
|
|
6
|
+
|
|
7
|
+
local IKRigInterface = require("IKRigInterface")
|
|
8
|
+
local TieRealmService = require("TieRealmService")
|
|
9
|
+
|
|
10
|
+
local IKDataService = {}
|
|
11
|
+
IKDataService.ServiceName = "IKDataService"
|
|
12
|
+
|
|
13
|
+
function IKDataService:Init(serviceBag)
|
|
14
|
+
assert(not self._serviceBag, "Already initialized")
|
|
15
|
+
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
16
|
+
|
|
17
|
+
self._tieRealmService = self._serviceBag:GetService(TieRealmService)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
function IKDataService:PromiseRig(humanoid)
|
|
21
|
+
return IKRigInterface:Promise(humanoid, self._tieRealmService:GetTieRealm())
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
function IKDataService:ObserveRig(humanoid)
|
|
25
|
+
return IKRigInterface:Observe(humanoid, self._tieRealmService:GetTieRealm())
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
function IKDataService:ObserveRigBrio(humanoid)
|
|
29
|
+
return IKRigInterface:ObserveBrio(humanoid, self._tieRealmService:GetTieRealm())
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
return IKDataService
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
--[=[
|
|
2
|
+
@class IKRigInterface
|
|
3
|
+
]=]
|
|
4
|
+
|
|
5
|
+
local require = require(script.Parent.loader).load(script)
|
|
6
|
+
|
|
7
|
+
local TieDefinition = require("TieDefinition")
|
|
8
|
+
|
|
9
|
+
return TieDefinition.new("IKRig", {
|
|
10
|
+
GetPlayer = TieDefinition.Types.METHOD;
|
|
11
|
+
GetHumanoid = TieDefinition.Types.METHOD;
|
|
12
|
+
|
|
13
|
+
PromiseLeftArm = TieDefinition.Types.METHOD;
|
|
14
|
+
PromiseRightArm = TieDefinition.Types.METHOD;
|
|
15
|
+
GetLeftArm = TieDefinition.Types.METHOD;
|
|
16
|
+
GetRightArm = TieDefinition.Types.METHOD;
|
|
17
|
+
|
|
18
|
+
GetAimPosition = TieDefinition.Types.METHOD;
|
|
19
|
+
})
|