@quenty/camera 14.45.0 → 14.46.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
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
|
+
# [14.46.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/camera@14.45.0...@quenty/camera@14.46.0) (2026-07-23)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- Additional fixes ([8714d52](https://github.com/Quenty/NevermoreEngine/commit/8714d52ed996f2e41e6daa191554acca35860e36))
|
|
11
|
+
- Cleanup code a bit ([fa8c596](https://github.com/Quenty/NevermoreEngine/commit/fa8c596544e45610e180f5ae3797154f35930ccd))
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
- Add baseline player-mock and support across Nevermore for mocked players. ([567d121](https://github.com/Quenty/NevermoreEngine/commit/567d121ffc014b42391554088189a1a6296dda83))
|
|
16
|
+
|
|
6
17
|
# [14.45.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/camera@14.44.0...@quenty/camera@14.45.0) (2026-07-18)
|
|
7
18
|
|
|
8
19
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/camera",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.46.0",
|
|
4
4
|
"description": "Quenty's camera system for Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -29,29 +29,31 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@quenty/acceltween": "2.7.0",
|
|
32
|
-
"@quenty/baseobject": "10.
|
|
32
|
+
"@quenty/baseobject": "10.15.0",
|
|
33
33
|
"@quenty/cframeutils": "5.5.6",
|
|
34
34
|
"@quenty/cubicspline": "10.13.0",
|
|
35
|
-
"@quenty/draw": "7.
|
|
35
|
+
"@quenty/draw": "7.16.0",
|
|
36
36
|
"@quenty/ducktype": "5.11.0",
|
|
37
|
-
"@quenty/inputobjectutils": "4.
|
|
37
|
+
"@quenty/inputobjectutils": "4.33.0",
|
|
38
38
|
"@quenty/loader": "10.11.0",
|
|
39
|
-
"@quenty/maid": "3.
|
|
39
|
+
"@quenty/maid": "3.11.0",
|
|
40
40
|
"@quenty/math": "2.7.5",
|
|
41
|
-
"@quenty/nevermore-test-runner": "1.
|
|
42
|
-
"@quenty/
|
|
43
|
-
"@quenty/
|
|
44
|
-
"@quenty/
|
|
41
|
+
"@quenty/nevermore-test-runner": "1.5.0",
|
|
42
|
+
"@quenty/playermock": "1.1.0",
|
|
43
|
+
"@quenty/qframe": "10.26.0",
|
|
44
|
+
"@quenty/rx": "13.31.0",
|
|
45
|
+
"@quenty/servicebag": "11.20.0",
|
|
45
46
|
"@quenty/spring": "10.12.0",
|
|
46
|
-
"@quenty/
|
|
47
|
+
"@quenty/steputils": "3.7.0",
|
|
48
|
+
"@quenty/valueobject": "13.34.0",
|
|
47
49
|
"@quenty/vector3utils": "10.11.0",
|
|
48
50
|
"@quentystudios/jest-lua": "3.10.0-quenty.2"
|
|
49
51
|
},
|
|
50
52
|
"devDependencies": {
|
|
51
|
-
"@quenty/camerastoryutils": "10.
|
|
53
|
+
"@quenty/camerastoryutils": "10.25.0"
|
|
52
54
|
},
|
|
53
55
|
"publishConfig": {
|
|
54
56
|
"access": "public"
|
|
55
57
|
},
|
|
56
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "1de37218a2bedb8e3f8614a2e09bba9eddc812da"
|
|
57
59
|
}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
local require = require(script.Parent.loader).load(script)
|
|
10
10
|
|
|
11
11
|
local HttpService = game:GetService("HttpService")
|
|
12
|
+
local Players = game:GetService("Players")
|
|
12
13
|
local RunService = game:GetService("RunService")
|
|
13
14
|
local Workspace = game:GetService("Workspace")
|
|
14
15
|
|
|
@@ -18,6 +19,7 @@ local CameraState = require("CameraState")
|
|
|
18
19
|
local DefaultCamera = require("DefaultCamera")
|
|
19
20
|
local ImpulseCamera = require("ImpulseCamera")
|
|
20
21
|
local Maid = require("Maid")
|
|
22
|
+
local PlayerMock = require("PlayerMock")
|
|
21
23
|
local ServiceBag = require("ServiceBag")
|
|
22
24
|
|
|
23
25
|
local CameraStackService = {}
|
|
@@ -65,6 +67,15 @@ function CameraStackService.GetRenderPriority(_self: CameraStackService): number
|
|
|
65
67
|
end
|
|
66
68
|
|
|
67
69
|
function CameraStackService.Start(self: CameraStackService): ()
|
|
70
|
+
self._started = true
|
|
71
|
+
|
|
72
|
+
-- BindToRenderStep is a client-only engine call. With a mock local player designated (headless
|
|
73
|
+
-- test runs, where nothing renders), there is no render loop to drive, so the stack stays passive.
|
|
74
|
+
local localPlayer = Players.LocalPlayer or PlayerMock.getMockedLocalPlayer()
|
|
75
|
+
if localPlayer ~= nil and PlayerMock.isMock(localPlayer) then
|
|
76
|
+
return
|
|
77
|
+
end
|
|
78
|
+
|
|
68
79
|
RunService:BindToRenderStep("CameraStackUpdateInternal" .. self._key, self:GetRenderPriority(), function()
|
|
69
80
|
debug.profilebegin("camerastackservice")
|
|
70
81
|
|
|
@@ -82,8 +93,6 @@ function CameraStackService.Start(self: CameraStackService): ()
|
|
|
82
93
|
RunService:UnbindFromRenderStep("CameraStackUpdateInternal" .. self._key)
|
|
83
94
|
end)
|
|
84
95
|
|
|
85
|
-
self._started = true
|
|
86
|
-
|
|
87
96
|
-- TODO: Allow rebinding
|
|
88
97
|
if self._doNotUseDefaultCamera then
|
|
89
98
|
Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
--!strict
|
|
2
|
+
--[[
|
|
3
|
+
@class CameraStackService.spec.lua
|
|
4
|
+
]]
|
|
5
|
+
|
|
6
|
+
local require = require(script.Parent.loader).load(script)
|
|
7
|
+
|
|
8
|
+
local Workspace = game:GetService("Workspace")
|
|
9
|
+
|
|
10
|
+
local CameraStackService = require("CameraStackService")
|
|
11
|
+
local CameraState = require("CameraState")
|
|
12
|
+
local CustomCameraEffect = require("CustomCameraEffect")
|
|
13
|
+
local Jest = require("Jest")
|
|
14
|
+
local PlayerMock = require("PlayerMock")
|
|
15
|
+
local ServiceBag = require("ServiceBag")
|
|
16
|
+
|
|
17
|
+
local afterEach = Jest.Globals.afterEach
|
|
18
|
+
local describe = Jest.Globals.describe
|
|
19
|
+
local expect = Jest.Globals.expect
|
|
20
|
+
local it = Jest.Globals.it
|
|
21
|
+
|
|
22
|
+
local currentServiceBag: ServiceBag.ServiceBag? = nil
|
|
23
|
+
local currentMock: Player? = nil
|
|
24
|
+
|
|
25
|
+
-- Boots the service the way production does (Init then Start). The mocked local player is designated
|
|
26
|
+
-- before boot so CameraStackService.Start skips BindToRenderStep, which is client-only and would
|
|
27
|
+
-- error in the server context these specs run in.
|
|
28
|
+
local function setup(options: { start: boolean? }?): CameraStackService.CameraStackService
|
|
29
|
+
local player = PlayerMock.new({ UserId = 66123201 })
|
|
30
|
+
player.Parent = Workspace
|
|
31
|
+
PlayerMock.setMockedLocalPlayer(player)
|
|
32
|
+
currentMock = player
|
|
33
|
+
|
|
34
|
+
local serviceBag = ServiceBag.new()
|
|
35
|
+
currentServiceBag = serviceBag
|
|
36
|
+
|
|
37
|
+
local service: CameraStackService.CameraStackService = serviceBag:GetService(CameraStackService) :: any
|
|
38
|
+
serviceBag:Init()
|
|
39
|
+
|
|
40
|
+
if not (options and options.start == false) then
|
|
41
|
+
serviceBag:Start()
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
return service
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
local function makeEffect(): (CustomCameraEffect.CustomCameraEffect, CameraState.CameraState)
|
|
48
|
+
local state = CameraState.new()
|
|
49
|
+
local effect = CustomCameraEffect.new(function()
|
|
50
|
+
return state
|
|
51
|
+
end)
|
|
52
|
+
return effect, state
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
afterEach(function()
|
|
56
|
+
if currentServiceBag then
|
|
57
|
+
currentServiceBag:Destroy()
|
|
58
|
+
currentServiceBag = nil
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
PlayerMock.setMockedLocalPlayer(nil)
|
|
62
|
+
if currentMock then
|
|
63
|
+
currentMock:Destroy()
|
|
64
|
+
currentMock = nil
|
|
65
|
+
end
|
|
66
|
+
end)
|
|
67
|
+
|
|
68
|
+
describe("CameraStackService.Init", function()
|
|
69
|
+
it("initializes with the default camera at the bottom of the stack", function()
|
|
70
|
+
local service = setup()
|
|
71
|
+
|
|
72
|
+
expect(#service:GetRawStack()).toBe(1)
|
|
73
|
+
expect(service:GetIndex(service:GetDefaultCamera())).toBe(1)
|
|
74
|
+
expect(service:GetTopCamera()).toBe(service:GetDefaultCamera())
|
|
75
|
+
expect(CameraState.isCameraState(service:GetTopState())).toBe(true)
|
|
76
|
+
end)
|
|
77
|
+
|
|
78
|
+
it("exposes the default, raw default, and impulse cameras", function()
|
|
79
|
+
local service = setup()
|
|
80
|
+
|
|
81
|
+
expect(service:GetDefaultCamera()).toBe(service:GetDefaultCamera())
|
|
82
|
+
expect(service:GetRawDefaultCamera()).toBe(service:GetRawDefaultCamera())
|
|
83
|
+
expect(service:GetImpulseCamera()).toBe(service:GetImpulseCamera())
|
|
84
|
+
end)
|
|
85
|
+
|
|
86
|
+
it("errors when used before the service bag runs Init", function()
|
|
87
|
+
local serviceBag = ServiceBag.new()
|
|
88
|
+
currentServiceBag = serviceBag
|
|
89
|
+
local service: CameraStackService.CameraStackService = serviceBag:GetService(CameraStackService) :: any
|
|
90
|
+
|
|
91
|
+
expect(function()
|
|
92
|
+
service:GetTopState()
|
|
93
|
+
end).toThrow("Not initialized")
|
|
94
|
+
|
|
95
|
+
-- Destroying a never-initialized CameraStackService errors on its nil maid, so finish
|
|
96
|
+
-- initialization for the afterEach teardown.
|
|
97
|
+
serviceBag:Init()
|
|
98
|
+
end)
|
|
99
|
+
end)
|
|
100
|
+
|
|
101
|
+
describe("CameraStackService.Add", function()
|
|
102
|
+
it("puts the effect on top of the stack and surfaces its state", function()
|
|
103
|
+
local service = setup()
|
|
104
|
+
local effect, state = makeEffect()
|
|
105
|
+
|
|
106
|
+
service:Add(effect)
|
|
107
|
+
|
|
108
|
+
expect(service:GetIndex(effect)).toBe(2)
|
|
109
|
+
expect(service:GetTopCamera()).toBe(effect)
|
|
110
|
+
expect(service:GetTopState()).toBe(state)
|
|
111
|
+
end)
|
|
112
|
+
|
|
113
|
+
it("returns a cleanup callback that removes the effect", function()
|
|
114
|
+
local service = setup()
|
|
115
|
+
local effect = makeEffect()
|
|
116
|
+
|
|
117
|
+
local removeEffect = service:Add(effect)
|
|
118
|
+
expect(service:GetIndex(effect)).toBe(2)
|
|
119
|
+
|
|
120
|
+
removeEffect()
|
|
121
|
+
expect(service:GetIndex(effect)).toBeNil()
|
|
122
|
+
expect(service:GetTopCamera()).toBe(service:GetDefaultCamera())
|
|
123
|
+
end)
|
|
124
|
+
end)
|
|
125
|
+
|
|
126
|
+
describe("CameraStackService.Remove", function()
|
|
127
|
+
it("removes the effect from anywhere in the stack", function()
|
|
128
|
+
local service = setup()
|
|
129
|
+
local effectA = makeEffect()
|
|
130
|
+
local effectB = makeEffect()
|
|
131
|
+
|
|
132
|
+
service:Add(effectA)
|
|
133
|
+
service:Add(effectB)
|
|
134
|
+
|
|
135
|
+
service:Remove(effectA)
|
|
136
|
+
|
|
137
|
+
expect(service:GetIndex(effectA)).toBeNil()
|
|
138
|
+
expect(service:GetIndex(effectB)).toBe(2)
|
|
139
|
+
expect(service:GetTopCamera()).toBe(effectB)
|
|
140
|
+
end)
|
|
141
|
+
end)
|
|
142
|
+
|
|
143
|
+
describe("CameraStackService.PushDisable", function()
|
|
144
|
+
it("hides the top state until cancelled", function()
|
|
145
|
+
local service = setup()
|
|
146
|
+
|
|
147
|
+
local cancel = service:PushDisable()
|
|
148
|
+
expect(service:GetTopState()).toBeNil()
|
|
149
|
+
|
|
150
|
+
cancel()
|
|
151
|
+
expect(CameraState.isCameraState(service:GetTopState())).toBe(true)
|
|
152
|
+
end)
|
|
153
|
+
end)
|
|
154
|
+
|
|
155
|
+
describe("CameraStackService.GetNewStateBelow", function()
|
|
156
|
+
it("resolves to the state below the effect once added", function()
|
|
157
|
+
local service = setup()
|
|
158
|
+
local belowEffect, belowState = makeEffect()
|
|
159
|
+
service:Add(belowEffect)
|
|
160
|
+
|
|
161
|
+
local effect, setState = service:GetNewStateBelow()
|
|
162
|
+
setState(effect)
|
|
163
|
+
service:Add(effect)
|
|
164
|
+
|
|
165
|
+
expect(service:GetIndex(effect)).toBe(3)
|
|
166
|
+
expect((effect :: any).CameraState).toBe(belowState)
|
|
167
|
+
end)
|
|
168
|
+
end)
|
|
169
|
+
|
|
170
|
+
describe("CameraStackService.SetDoNotUseDefaultCamera", function()
|
|
171
|
+
it("can be set before the service starts", function()
|
|
172
|
+
local service = setup({ start = false })
|
|
173
|
+
|
|
174
|
+
expect(function()
|
|
175
|
+
service:SetDoNotUseDefaultCamera(true)
|
|
176
|
+
end).never.toThrow()
|
|
177
|
+
end)
|
|
178
|
+
|
|
179
|
+
it("errors once the service has started", function()
|
|
180
|
+
local service = setup()
|
|
181
|
+
|
|
182
|
+
expect(function()
|
|
183
|
+
service:SetDoNotUseDefaultCamera(true)
|
|
184
|
+
end).toThrow("Already started")
|
|
185
|
+
end)
|
|
186
|
+
end)
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
local require = require(script.Parent.loader).load(script)
|
|
8
8
|
|
|
9
9
|
local ContextActionService = game:GetService("ContextActionService")
|
|
10
|
-
local RunService = game:GetService("RunService")
|
|
11
10
|
local UserInputService = game:GetService("UserInputService")
|
|
12
11
|
|
|
13
12
|
local GamepadRotateModel = require("GamepadRotateModel")
|
|
@@ -16,6 +15,7 @@ local Maid = require("Maid")
|
|
|
16
15
|
local PushCamera = require("PushCamera")
|
|
17
16
|
local SmoothRotatedCamera = require("SmoothRotatedCamera")
|
|
18
17
|
local SmoothZoomedCamera = require("SmoothZoomedCamera")
|
|
18
|
+
local StepUtils = require("StepUtils")
|
|
19
19
|
|
|
20
20
|
-- Stolen directly from ROBLOX's core scripts.
|
|
21
21
|
-- Looks like a simple integrator.
|
|
@@ -380,8 +380,10 @@ function CameraControls._handleGamepadRotateStart(self: CameraControls): ()
|
|
|
380
380
|
self._rotVelocityTracker = self:_getVelocityTracker(0.05, Vector2.zero)
|
|
381
381
|
end
|
|
382
382
|
|
|
383
|
-
maid:GiveTask(
|
|
384
|
-
|
|
383
|
+
maid:GiveTask(StepUtils.getAnimationStepSignal():Connect(function(deltaTime: number)
|
|
384
|
+
-- Sensitivity is tuned per-60Hz-frame; scale by deltaTime * 60 so rotation speed is
|
|
385
|
+
-- framerate independent.
|
|
386
|
+
local deltaAngle: Vector2 = 0.1 * (deltaTime * 60) * self._gamepadRotateModel:GetThumbstickDeltaAngle()
|
|
385
387
|
|
|
386
388
|
if self._rotatedCamera then
|
|
387
389
|
self._rotatedCamera:RotateXY(deltaAngle)
|
|
@@ -9,13 +9,15 @@
|
|
|
9
9
|
local require = require(script.Parent.loader).load(script)
|
|
10
10
|
|
|
11
11
|
local ContextActionService = game:GetService("ContextActionService")
|
|
12
|
-
local
|
|
12
|
+
local Players = game:GetService("Players")
|
|
13
13
|
local UserInputService = game:GetService("UserInputService")
|
|
14
14
|
|
|
15
15
|
local ConstrainedLookCamera = require("ConstrainedLookCamera")
|
|
16
16
|
local GamepadRotateModel = require("GamepadRotateModel")
|
|
17
17
|
local InputObjectUtils = require("InputObjectUtils")
|
|
18
18
|
local Maid = require("Maid")
|
|
19
|
+
local PlayerMock = require("PlayerMock")
|
|
20
|
+
local StepUtils = require("StepUtils")
|
|
19
21
|
|
|
20
22
|
local ConstrainedLookControls = {}
|
|
21
23
|
ConstrainedLookControls.__index = ConstrainedLookControls
|
|
@@ -97,22 +99,53 @@ function ConstrainedLookControls.Enable(self: ConstrainedLookControls)
|
|
|
97
99
|
end
|
|
98
100
|
end))
|
|
99
101
|
|
|
100
|
-
|
|
102
|
+
local function onDragAction(_, userInputState: Enum.UserInputState, inputObject: InputObject)
|
|
101
103
|
if userInputState == Enum.UserInputState.Begin then
|
|
102
104
|
self:_beginDrag(inputObject)
|
|
103
105
|
end
|
|
104
106
|
return Enum.ContextActionResult.Pass
|
|
105
|
-
end
|
|
107
|
+
end
|
|
106
108
|
|
|
107
|
-
|
|
109
|
+
local function onRotateAction(_, _, inputObject: InputObject)
|
|
108
110
|
self._gamepadRotateModel:HandleThumbstickInput(inputObject)
|
|
109
111
|
return Enum.ContextActionResult.Pass
|
|
110
|
-
end
|
|
112
|
+
end
|
|
111
113
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
-- BindAction is a client-only engine call. With a mock local player designated (headless test
|
|
115
|
+
-- runs, where there is no input to receive), the actions bind on the mock instead and a test
|
|
116
|
+
-- dispatches them through [PlayerMock.fireInput].
|
|
117
|
+
local localPlayer = Players.LocalPlayer or PlayerMock.getMockedLocalPlayer()
|
|
118
|
+
if localPlayer ~= nil and PlayerMock.isMock(localPlayer) then
|
|
119
|
+
PlayerMock.bindInput(
|
|
120
|
+
localPlayer,
|
|
121
|
+
"ContextActionService.BindAction",
|
|
122
|
+
self._key .. "Drag",
|
|
123
|
+
onDragAction,
|
|
124
|
+
false,
|
|
125
|
+
unpack(self._dragBeginTypes)
|
|
126
|
+
)
|
|
127
|
+
PlayerMock.bindInput(
|
|
128
|
+
localPlayer,
|
|
129
|
+
"ContextActionService.BindAction",
|
|
130
|
+
self._key .. "Rotate",
|
|
131
|
+
onRotateAction,
|
|
132
|
+
false,
|
|
133
|
+
Enum.KeyCode.Thumbstick2
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
maid:GiveTask(function()
|
|
137
|
+
PlayerMock.bindInput(localPlayer, "ContextActionService.UnbindAction", self._key .. "Drag")
|
|
138
|
+
PlayerMock.bindInput(localPlayer, "ContextActionService.UnbindAction", self._key .. "Rotate")
|
|
139
|
+
end)
|
|
140
|
+
else
|
|
141
|
+
ContextActionService:BindAction(self._key .. "Drag", onDragAction, false, unpack(self._dragBeginTypes))
|
|
142
|
+
ContextActionService:BindAction(self._key .. "Rotate", onRotateAction, false, Enum.KeyCode.Thumbstick2)
|
|
143
|
+
|
|
144
|
+
maid:GiveTask(function()
|
|
145
|
+
ContextActionService:UnbindAction(self._key .. "Drag")
|
|
146
|
+
ContextActionService:UnbindAction(self._key .. "Rotate")
|
|
147
|
+
end)
|
|
148
|
+
end
|
|
116
149
|
|
|
117
150
|
maid:GiveTask(function()
|
|
118
151
|
self._camera:Release()
|
|
@@ -196,8 +229,12 @@ function ConstrainedLookControls._handleGamepadRotateStart(self: ConstrainedLook
|
|
|
196
229
|
|
|
197
230
|
local maid = Maid.new()
|
|
198
231
|
|
|
199
|
-
maid:GiveTask(
|
|
200
|
-
|
|
232
|
+
maid:GiveTask(StepUtils.getAnimationStepSignal():Connect(function(deltaTime: number)
|
|
233
|
+
-- Sensitivity is tuned per-60Hz-frame; scale by deltaTime * 60 so rotation speed is
|
|
234
|
+
-- framerate independent without changing the units of GAMEPAD_SENSITIVITY.
|
|
235
|
+
local deltaAngle = self._gamepadSensitivity
|
|
236
|
+
* (deltaTime * 60)
|
|
237
|
+
* self._gamepadRotateModel:GetThumbstickDeltaAngle()
|
|
201
238
|
self._camera:RotateXY(deltaAngle)
|
|
202
239
|
end))
|
|
203
240
|
|