@quenty/camera 14.18.2 → 14.18.3-canary.534.e0a44d2.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.18.3-canary.534.e0a44d2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/camera@14.18.2...@quenty/camera@14.18.3-canary.534.e0a44d2.0) (2025-01-28)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add FirstPerson detection to the DefaultCamera in the camera stack, to query Roblox state ([aa97281](https://github.com/Quenty/NevermoreEngine/commit/aa97281208a51dd5141938fca3ec92db1247081c))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [14.18.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/camera@14.18.1...@quenty/camera@14.18.2) (2025-01-22)
7
18
 
8
19
  **Note:** Version bump only for package @quenty/camera
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/camera",
3
- "version": "14.18.2",
3
+ "version": "14.18.3-canary.534.e0a44d2.0",
4
4
  "description": "Quenty's camera system for Roblox",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -25,26 +25,26 @@
25
25
  "Quenty"
26
26
  ],
27
27
  "dependencies": {
28
- "@quenty/acceltween": "^2.5.0",
29
- "@quenty/baseobject": "^10.7.1",
30
- "@quenty/cframeutils": "^5.5.0",
31
- "@quenty/cubicspline": "^10.7.1",
32
- "@quenty/ducktype": "^5.7.1",
33
- "@quenty/inputobjectutils": "^4.16.0",
34
- "@quenty/loader": "^10.7.1",
35
- "@quenty/maid": "^3.4.0",
36
- "@quenty/math": "^2.7.0",
37
- "@quenty/qframe": "^10.9.0",
38
- "@quenty/servicebag": "^11.10.0",
39
- "@quenty/spring": "^10.7.1",
40
- "@quenty/valueobject": "^13.15.0",
41
- "@quenty/vector3utils": "^10.7.1"
28
+ "@quenty/acceltween": "2.5.0",
29
+ "@quenty/baseobject": "10.7.1",
30
+ "@quenty/cframeutils": "5.5.0",
31
+ "@quenty/cubicspline": "10.7.1",
32
+ "@quenty/ducktype": "5.7.1",
33
+ "@quenty/inputobjectutils": "4.16.0",
34
+ "@quenty/loader": "10.7.1",
35
+ "@quenty/maid": "3.4.0",
36
+ "@quenty/math": "2.7.0",
37
+ "@quenty/qframe": "10.9.0",
38
+ "@quenty/servicebag": "11.10.0",
39
+ "@quenty/spring": "10.7.1",
40
+ "@quenty/valueobject": "13.15.0",
41
+ "@quenty/vector3utils": "10.7.1"
42
42
  },
43
43
  "devDependencies": {
44
- "@quenty/camerastoryutils": "^10.9.0"
44
+ "@quenty/camerastoryutils": "10.9.0"
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "86c00a8210666aa2da1950fc3a41945763d4c321"
49
+ "gitHead": "e0a44d2ca0a612beb227c36fee1837e0898c3207"
50
50
  }
@@ -17,6 +17,7 @@ local SummedCamera = require("SummedCamera")
17
17
  local Maid = require("Maid")
18
18
  local CFrameUtils = require("CFrameUtils")
19
19
  local CameraFrame = require("CameraFrame")
20
+ local ValueObject = require("ValueObject")
20
21
 
21
22
  local EPSILON = 0.001
22
23
 
@@ -35,6 +36,8 @@ function DefaultCamera.new()
35
36
  self._maid = Maid.new()
36
37
  self._cameraState = CameraState.new(Workspace.CurrentCamera)
37
38
 
39
+ self._isFirstPerson = self._maid:Add(ValueObject.new(false, "boolean"))
40
+
38
41
  return self
39
42
  end
40
43
 
@@ -92,6 +95,32 @@ function DefaultCamera:SetLastSetCameraFrame(cameraFrame)
92
95
  self._lastCameraFrame = CameraFrame.new(cameraFrame.QFrame, cameraFrame.FieldOfView)
93
96
  end
94
97
 
98
+ --[=[
99
+ Gets whether the Roblox camera is in first person
100
+ ]=]
101
+ function DefaultCamera:IsFirstPerson(): boolean
102
+ return self._isFirstPerson.Value
103
+ end
104
+
105
+ --[=[
106
+ Gets whether the Roblox camera is in first person
107
+
108
+ @return Observable<boolean>
109
+ ]=]
110
+ function DefaultCamera:ObserveIsFirstPerson()
111
+ return self._isFirstPerson:Observe()
112
+ end
113
+
114
+ --[=[
115
+ Gets whether the Roblox camera is in first person
116
+
117
+ @param predicate ((inFirstPerson: boolean) -> boolean)?
118
+ @return Observable<Brio<boolean>>
119
+ ]=]
120
+ function DefaultCamera:ObserveIsFirstPersonBrio(predicate)
121
+ return self._isFirstPerson:Observe(predicate)
122
+ end
123
+
95
124
  --[=[
96
125
  Binds the camera to RunService RenderStepped event.
97
126
 
@@ -125,11 +154,18 @@ function DefaultCamera:BindToRenderStep()
125
154
  end)
126
155
 
127
156
  RunService:BindToRenderStep("DefaultCamera_PostUpdate" .. self._key, Enum.RenderPriority.Camera.Value+2, function()
157
+ local camera = Workspace.CurrentCamera
158
+
159
+ -- Based upon Roblox's camera scripts
160
+ local distance = (camera.CFrame.Position - camera.Focus.Position).magnitude
161
+ self._isFirstPerson.Value = distance <= 0.75
162
+
128
163
  -- Capture
129
- self._cameraState = CameraState.new(Workspace.CurrentCamera)
164
+ self._cameraState = CameraState.new(camera)
130
165
  end)
131
166
 
132
167
  maid:GiveTask(function()
168
+ self._isFirstPerson.Value = false
133
169
  RunService:UnbindFromRenderStep("DefaultCamera_Preupdate" .. self._key)
134
170
  RunService:UnbindFromRenderStep("DefaultCamera_PostUpdate" .. self._key)
135
171
  end)