@quenty/camerastoryutils 10.10.4 → 10.10.5-canary.11a5dcf.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 +6 -6
- package/src/Client/CameraStoryUtils.lua +33 -21
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
|
+
## [10.10.5-canary.11a5dcf.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/camerastoryutils@10.10.4...@quenty/camerastoryutils@10.10.5-canary.11a5dcf.0) (2025-05-10)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Additional type checking updates ([05ba29a](https://github.com/Quenty/NevermoreEngine/commit/05ba29a03efc9f3feed74b34f1d9dfb237496214))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [10.10.4](https://github.com/Quenty/NevermoreEngine/compare/@quenty/camerastoryutils@10.10.3...@quenty/camerastoryutils@10.10.4) (2025-04-10)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @quenty/camerastoryutils
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/camerastoryutils",
|
|
3
|
-
"version": "10.10.
|
|
3
|
+
"version": "10.10.5-canary.11a5dcf.0",
|
|
4
4
|
"description": "CameraStoryUtils - utility functions for 3D viewport hoarcekat stories.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"Quenty"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@quenty/insertserviceutils": "
|
|
30
|
-
"@quenty/loader": "
|
|
31
|
-
"@quenty/math": "
|
|
32
|
-
"@quenty/promise": "
|
|
29
|
+
"@quenty/insertserviceutils": "10.10.5-canary.11a5dcf.0",
|
|
30
|
+
"@quenty/loader": "10.8.4-canary.11a5dcf.0",
|
|
31
|
+
"@quenty/math": "2.7.3",
|
|
32
|
+
"@quenty/promise": "10.10.5-canary.11a5dcf.0"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "11a5dcf7d4c7a0bfbf3337e97d30e8346ea09d3f"
|
|
38
38
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
--!strict
|
|
1
2
|
--[=[
|
|
2
3
|
Utility functions for hoacekat stories.
|
|
3
4
|
@class CameraStoryUtils
|
|
@@ -9,8 +10,9 @@ local RunService = game:GetService("RunService")
|
|
|
9
10
|
local TextService = game:GetService("TextService")
|
|
10
11
|
|
|
11
12
|
local InsertServiceUtils = require("InsertServiceUtils")
|
|
12
|
-
local
|
|
13
|
+
local Maid = require("Maid")
|
|
13
14
|
local Math = require("Math")
|
|
15
|
+
local Promise = require("Promise")
|
|
14
16
|
|
|
15
17
|
local CameraStoryUtils = {}
|
|
16
18
|
|
|
@@ -20,7 +22,7 @@ local CameraStoryUtils = {}
|
|
|
20
22
|
@param topCamera Camera
|
|
21
23
|
@return Camera
|
|
22
24
|
]=]
|
|
23
|
-
function CameraStoryUtils.reflectCamera(maid, topCamera: Camera)
|
|
25
|
+
function CameraStoryUtils.reflectCamera(maid: Maid.Maid, topCamera: Camera): Camera
|
|
24
26
|
local camera = Instance.new("Camera")
|
|
25
27
|
camera.Name = "ReflectedCamera"
|
|
26
28
|
maid:GiveTask(camera)
|
|
@@ -43,7 +45,7 @@ end
|
|
|
43
45
|
@param target GuiBase
|
|
44
46
|
@return ViewportFrame
|
|
45
47
|
]=]
|
|
46
|
-
function CameraStoryUtils.setupViewportFrame(maid, target: GuiBase)
|
|
48
|
+
function CameraStoryUtils.setupViewportFrame(maid: Maid.Maid, target: GuiBase)
|
|
47
49
|
local viewportFrame = Instance.new("ViewportFrame")
|
|
48
50
|
viewportFrame.ZIndex = 0
|
|
49
51
|
viewportFrame.BorderSizePixel = 0
|
|
@@ -67,11 +69,15 @@ end
|
|
|
67
69
|
@param properties { [string}: any }
|
|
68
70
|
@return Promise<Instance>
|
|
69
71
|
]=]
|
|
70
|
-
function CameraStoryUtils.promiseCrate(
|
|
72
|
+
function CameraStoryUtils.promiseCrate(
|
|
73
|
+
maid: Maid.Maid,
|
|
74
|
+
viewportFrame: ViewportFrame,
|
|
75
|
+
properties
|
|
76
|
+
): Promise.Promise<Instance>
|
|
71
77
|
return maid:GivePromise(InsertServiceUtils.promiseAsset(182451181)):Then(function(model)
|
|
72
78
|
maid:GiveTask(model)
|
|
73
79
|
|
|
74
|
-
local crate = model:GetChildren()[1]
|
|
80
|
+
local crate = (model :: any):GetChildren()[1]
|
|
75
81
|
if not crate then
|
|
76
82
|
return Promise.rejected()
|
|
77
83
|
end
|
|
@@ -92,7 +98,7 @@ function CameraStoryUtils.promiseCrate(maid, viewportFrame, properties)
|
|
|
92
98
|
local camera = viewportFrame.CurrentCamera
|
|
93
99
|
if camera then
|
|
94
100
|
local cameraCFrame = camera.CFrame
|
|
95
|
-
local cframe = CFrame.new(cameraCFrame.Position + cameraCFrame.
|
|
101
|
+
local cframe = CFrame.new(cameraCFrame.Position + cameraCFrame.LookVector * 25)
|
|
96
102
|
crate:SetPrimaryPartCFrame(cframe)
|
|
97
103
|
end
|
|
98
104
|
end
|
|
@@ -111,7 +117,14 @@ end
|
|
|
111
117
|
@param toCFrame CFrame
|
|
112
118
|
@return (interpolate: function, color: Color3, label: string?, labelOffset: Vector2?) -> ()
|
|
113
119
|
]=]
|
|
114
|
-
function CameraStoryUtils.getInterpolationFactory(
|
|
120
|
+
function CameraStoryUtils.getInterpolationFactory(
|
|
121
|
+
maid: Maid.Maid,
|
|
122
|
+
viewportFrame: ViewportFrame,
|
|
123
|
+
low: number,
|
|
124
|
+
high: number,
|
|
125
|
+
period: number,
|
|
126
|
+
toCFrame: CFrame
|
|
127
|
+
)
|
|
115
128
|
assert(maid, "Bad maid")
|
|
116
129
|
assert(viewportFrame, "Bad viewportFrame")
|
|
117
130
|
assert(type(low) == "number", "Bad low")
|
|
@@ -126,10 +139,9 @@ function CameraStoryUtils.getInterpolationFactory(maid, viewportFrame, low, high
|
|
|
126
139
|
labelOffset = labelOffset or Vector2.zero
|
|
127
140
|
|
|
128
141
|
maid:GivePromise(CameraStoryUtils.promiseCrate(maid, viewportFrame, {
|
|
129
|
-
Color = color
|
|
130
|
-
Transparency = 0.5
|
|
131
|
-
}))
|
|
132
|
-
:Then(function(crate)
|
|
142
|
+
Color = color,
|
|
143
|
+
Transparency = 0.5,
|
|
144
|
+
})):Then(function(crate)
|
|
133
145
|
local label
|
|
134
146
|
if labelText then
|
|
135
147
|
local h, s, _ = Color3.toHSV(color)
|
|
@@ -170,7 +182,7 @@ function CameraStoryUtils.getInterpolationFactory(maid, viewportFrame, low, high
|
|
|
170
182
|
end
|
|
171
183
|
end
|
|
172
184
|
|
|
173
|
-
|
|
185
|
+
maid:GiveTask(RunService.RenderStepped:Connect(function()
|
|
174
186
|
local t = (os.clock() / period % 2 / period) * period
|
|
175
187
|
if t >= 1 then
|
|
176
188
|
t = 1 - (t % 1)
|
|
@@ -185,22 +197,22 @@ function CameraStoryUtils.getInterpolationFactory(maid, viewportFrame, low, high
|
|
|
185
197
|
local camera = viewportFrame.CurrentCamera
|
|
186
198
|
local pos = camera:WorldToViewportPoint(cframe.p)
|
|
187
199
|
local viewportSize = viewportFrame.AbsoluteSize
|
|
188
|
-
local aspectRatio = viewportSize.
|
|
189
|
-
if pos.
|
|
200
|
+
local aspectRatio = viewportSize.X / viewportSize.Y
|
|
201
|
+
if pos.Z > 0 then
|
|
190
202
|
label.Position =
|
|
191
|
-
UDim2.new((pos.
|
|
203
|
+
UDim2.new((pos.X - 0.5) / aspectRatio + 0.5, labelOffset.X, pos.Y, 0 + labelOffset.Y)
|
|
192
204
|
label.Visible = true
|
|
193
205
|
else
|
|
194
206
|
label.Visible = false
|
|
195
207
|
end
|
|
196
208
|
end
|
|
197
209
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
210
|
+
for part, rel in relCFrame do
|
|
211
|
+
part.CFrame = cframe:toWorldSpace(rel)
|
|
212
|
+
end
|
|
213
|
+
end))
|
|
214
|
+
end)
|
|
203
215
|
end
|
|
204
216
|
end
|
|
205
217
|
|
|
206
|
-
return CameraStoryUtils
|
|
218
|
+
return CameraStoryUtils
|