@quenty/camerastoryutils 10.10.1 → 10.10.2
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 +63 -62
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.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/camerastoryutils@10.10.1...@quenty/camerastoryutils@10.10.2) (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
|
## [10.10.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/camerastoryutils@10.10.0...@quenty/camerastoryutils@10.10.1) (2025-03-21)
|
|
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.2",
|
|
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": "^10.10.
|
|
30
|
-
"@quenty/loader": "^10.8.
|
|
31
|
-
"@quenty/math": "^2.7.
|
|
32
|
-
"@quenty/promise": "^10.10.
|
|
29
|
+
"@quenty/insertserviceutils": "^10.10.2",
|
|
30
|
+
"@quenty/loader": "^10.8.1",
|
|
31
|
+
"@quenty/math": "^2.7.2",
|
|
32
|
+
"@quenty/promise": "^10.10.2"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "78c3ac0ab08dd18085b6e6e6e4f745e76ed99f68"
|
|
38
38
|
}
|
|
@@ -20,7 +20,7 @@ local CameraStoryUtils = {}
|
|
|
20
20
|
@param topCamera Camera
|
|
21
21
|
@return Camera
|
|
22
22
|
]=]
|
|
23
|
-
function CameraStoryUtils.reflectCamera(maid, topCamera)
|
|
23
|
+
function CameraStoryUtils.reflectCamera(maid, topCamera: Camera)
|
|
24
24
|
local camera = Instance.new("Camera")
|
|
25
25
|
camera.Name = "ReflectedCamera"
|
|
26
26
|
maid:GiveTask(camera)
|
|
@@ -43,7 +43,7 @@ end
|
|
|
43
43
|
@param target GuiBase
|
|
44
44
|
@return ViewportFrame
|
|
45
45
|
]=]
|
|
46
|
-
function CameraStoryUtils.setupViewportFrame(maid, target)
|
|
46
|
+
function CameraStoryUtils.setupViewportFrame(maid, target: GuiBase)
|
|
47
47
|
local viewportFrame = Instance.new("ViewportFrame")
|
|
48
48
|
viewportFrame.ZIndex = 0
|
|
49
49
|
viewportFrame.BorderSizePixel = 0
|
|
@@ -77,9 +77,9 @@ function CameraStoryUtils.promiseCrate(maid, viewportFrame, properties)
|
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
if properties then
|
|
80
|
-
for _, item in
|
|
80
|
+
for _, item in crate:GetDescendants() do
|
|
81
81
|
if item:IsA("BasePart") then
|
|
82
|
-
for property, value in
|
|
82
|
+
for property, value in properties do
|
|
83
83
|
item[property] = value
|
|
84
84
|
end
|
|
85
85
|
end
|
|
@@ -92,7 +92,7 @@ function CameraStoryUtils.promiseCrate(maid, viewportFrame, properties)
|
|
|
92
92
|
local camera = viewportFrame.CurrentCamera
|
|
93
93
|
if camera then
|
|
94
94
|
local cameraCFrame = camera.CFrame
|
|
95
|
-
local cframe = CFrame.new(cameraCFrame.Position + cameraCFrame.lookVector*25)
|
|
95
|
+
local cframe = CFrame.new(cameraCFrame.Position + cameraCFrame.lookVector * 25)
|
|
96
96
|
crate:SetPrimaryPartCFrame(cframe)
|
|
97
97
|
end
|
|
98
98
|
end
|
|
@@ -130,71 +130,72 @@ function CameraStoryUtils.getInterpolationFactory(maid, viewportFrame, low, high
|
|
|
130
130
|
Transparency = 0.5
|
|
131
131
|
}))
|
|
132
132
|
:Then(function(crate)
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
133
|
+
local label
|
|
134
|
+
if labelText then
|
|
135
|
+
local h, s, _ = Color3.toHSV(color)
|
|
136
|
+
label = Instance.new("TextLabel")
|
|
137
|
+
label.AnchorPoint = Vector2.new(0.5, 0.5)
|
|
138
|
+
label.Text = labelText
|
|
139
|
+
label.BorderSizePixel = 0
|
|
140
|
+
label.BackgroundTransparency = 0.5
|
|
141
|
+
label.BackgroundColor3 = Color3.fromHSV(h, math.clamp(s / (s + 0.1), 0, 1), 0.25)
|
|
142
|
+
label.TextColor3 = Color3.new(1, 1, 1)
|
|
143
|
+
label.Font = Enum.Font.FredokaOne
|
|
144
|
+
label.TextSize = 15
|
|
145
|
+
label.Parent = viewportFrame
|
|
146
|
+
label.Visible = false
|
|
147
|
+
maid:GiveTask(label)
|
|
148
|
+
|
|
149
|
+
local size = TextService:GetTextSize(labelText, label.TextSize, label.Font, Vector2.new(1e6, 1e6))
|
|
150
|
+
label.Size = UDim2.new(0, size.x + 20, 0, 20)
|
|
151
|
+
|
|
152
|
+
local uiCorner = Instance.new("UICorner")
|
|
153
|
+
uiCorner.CornerRadius = UDim.new(0.5, 0)
|
|
154
|
+
uiCorner.Parent = label
|
|
155
|
+
maid:GiveTask(label)
|
|
156
|
+
end
|
|
157
157
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
end
|
|
158
|
+
-- avoid floating point numbers from :SetPrimaryPartCFrame
|
|
159
|
+
local primaryPart, primaryCFrame
|
|
160
|
+
local relCFrame = {}
|
|
161
|
+
for _, part in crate:GetDescendants() do
|
|
162
|
+
if part:IsA("BasePart") then
|
|
163
|
+
if primaryPart then
|
|
164
|
+
relCFrame[part] = primaryCFrame:toObjectSpace(part.CFrame)
|
|
165
|
+
else
|
|
166
|
+
primaryPart = part
|
|
167
|
+
primaryCFrame = part.CFrame
|
|
168
|
+
relCFrame[part] = CFrame.new()
|
|
170
169
|
end
|
|
171
170
|
end
|
|
171
|
+
end
|
|
172
172
|
|
|
173
173
|
maid:GiveTask(RunService.RenderStepped:Connect(function()
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
174
|
+
local t = (os.clock() / period % 2 / period) * period
|
|
175
|
+
if t >= 1 then
|
|
176
|
+
t = 1 - (t % 1)
|
|
177
|
+
end
|
|
178
178
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
179
|
+
t = Math.map(t, 0, 1, low, high)
|
|
180
|
+
t = math.clamp(t, low, high)
|
|
181
|
+
|
|
182
|
+
local cframe = toCFrame(interpolate(t))
|
|
183
|
+
|
|
184
|
+
if label then
|
|
185
|
+
local camera = viewportFrame.CurrentCamera
|
|
186
|
+
local pos = camera:WorldToViewportPoint(cframe.p)
|
|
187
|
+
local viewportSize = viewportFrame.AbsoluteSize
|
|
188
|
+
local aspectRatio = viewportSize.x / viewportSize.y
|
|
189
|
+
if pos.z > 0 then
|
|
190
|
+
label.Position =
|
|
191
|
+
UDim2.new((pos.x - 0.5) / aspectRatio + 0.5, labelOffset.x, pos.y, 0 + labelOffset.y)
|
|
192
|
+
label.Visible = true
|
|
193
|
+
else
|
|
194
|
+
label.Visible = false
|
|
195
195
|
end
|
|
196
|
+
end
|
|
196
197
|
|
|
197
|
-
for part, rel in
|
|
198
|
+
for part, rel in relCFrame do
|
|
198
199
|
part.CFrame = cframe:toWorldSpace(rel)
|
|
199
200
|
end
|
|
200
201
|
end))
|