@quenty/camera 4.4.0 → 5.0.1-canary.238.2c4d310.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 +16 -0
- package/README.md +2 -2
- package/package.json +14 -14
- package/src/Client/CameraStackService.lua +85 -27
- package/src/Client/CameraState.lua +23 -55
- package/src/Client/CameraUtils.lua +52 -4
- package/src/Client/CameraUtils.story.lua +3 -3
- package/src/Client/Controls/CameraControls.lua +7 -5
- package/src/Client/Controls/CameraGamepadInputUtils.lua +3 -3
- package/src/Client/Controls/GamepadRotateModel.lua +4 -2
- package/src/Client/Effects/CameraEffectUtils.lua +19 -0
- package/src/Client/Effects/CustomCameraEffect.lua +15 -4
- package/src/Client/Effects/DefaultCamera.lua +32 -3
- package/src/Client/Effects/FadeBetween/FadeBetweenCamera.lua +15 -2
- package/src/Client/Effects/FadeBetween/FadeBetweenCamera2.lua +14 -3
- package/src/Client/Effects/FadeBetween/FadeBetweenCamera3.lua +15 -2
- package/src/Client/Effects/FadeBetween/FadeBetweenCamera4.lua +14 -3
- package/src/Client/Effects/FadingCamera.lua +13 -2
- package/src/Client/Effects/HeartbeatCamera.lua +13 -4
- package/src/Client/Effects/ImpulseCamera.lua +16 -3
- package/src/Client/Effects/InverseFader.lua +4 -2
- package/src/Client/Effects/LagPointCamera.lua +5 -3
- package/src/Client/Effects/PointCamera.lua +10 -6
- package/src/Client/Effects/PushCamera.lua +24 -5
- package/src/Client/Effects/RotatedCamera.lua +17 -5
- package/src/Client/Effects/SmoothPositionCamera.lua +4 -2
- package/src/Client/Effects/SmoothRotatedCamera.lua +7 -5
- package/src/Client/Effects/SmoothZoomedCamera.lua +7 -4
- package/src/Client/Effects/SummedCamera.lua +18 -10
- package/src/Client/Effects/TrackCamera.lua +27 -6
- package/src/Client/Effects/XZPlaneLockCamera.lua +4 -2
- package/src/Client/Effects/ZoomedCamera.lua +16 -10
- package/src/Client/Input/CameraInputUtils.lua +3 -3
- package/src/Client/Input/CameraTouchInputUtils.lua +13 -5
- package/src/Client/Utility/CameraFrame.lua +82 -4
- package/src/Client/Utility/CameraFrame.story.lua +3 -3
- package/src/Client/Utility/CameraStateTweener.lua +69 -8
- package/src/Client/Utility/FieldOfViewUtils.lua +34 -4
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Add another layer of effects that can be faded in/out
|
|
3
|
+
@class FadeBetweenCamera
|
|
4
|
+
]=]
|
|
3
5
|
|
|
4
6
|
local require = require(script.Parent.loader).load(script)
|
|
5
7
|
|
|
@@ -12,6 +14,11 @@ local CubicSplineUtils = require("CubicSplineUtils")
|
|
|
12
14
|
local FadeBetweenCamera = {}
|
|
13
15
|
FadeBetweenCamera.ClassName = "FadeBetweenCamera"
|
|
14
16
|
|
|
17
|
+
--[=[
|
|
18
|
+
@param cameraA CameraLike
|
|
19
|
+
@param cameraB CameraLike
|
|
20
|
+
@return FadeBetweenCamera
|
|
21
|
+
]=]
|
|
15
22
|
function FadeBetweenCamera.new(cameraA, cameraB)
|
|
16
23
|
local self = setmetatable({
|
|
17
24
|
_spring = Spring.new(0);
|
|
@@ -47,6 +54,12 @@ function FadeBetweenCamera:__newindex(index, value)
|
|
|
47
54
|
end
|
|
48
55
|
end
|
|
49
56
|
|
|
57
|
+
--[=[
|
|
58
|
+
The current state.
|
|
59
|
+
@readonly
|
|
60
|
+
@prop CameraState CameraState
|
|
61
|
+
@within FadeBetweenCamera
|
|
62
|
+
]=]
|
|
50
63
|
function FadeBetweenCamera:__index(index)
|
|
51
64
|
if index == "CameraState" then
|
|
52
65
|
local _, t = SpringUtils.animating(self._spring)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
@class FadeBetweenCamera2
|
|
3
|
+
]=]
|
|
4
4
|
|
|
5
5
|
local require = require(script.Parent.loader).load(script)
|
|
6
6
|
|
|
@@ -11,6 +11,11 @@ local FadeBetweenCamera2 = {}
|
|
|
11
11
|
FadeBetweenCamera2.ClassName = "FadeBetweenCamera2"
|
|
12
12
|
FadeBetweenCamera2.__index = FadeBetweenCamera2
|
|
13
13
|
|
|
14
|
+
--[=[
|
|
15
|
+
@param cameraA CameraLike
|
|
16
|
+
@param cameraB CameraLike
|
|
17
|
+
@return FadeBetweenCamera2
|
|
18
|
+
]=]
|
|
14
19
|
function FadeBetweenCamera2.new(cameraA, cameraB)
|
|
15
20
|
local self = setmetatable({
|
|
16
21
|
CameraA = cameraA or error("No cameraA");
|
|
@@ -61,6 +66,12 @@ function FadeBetweenCamera2:__newindex(index, value)
|
|
|
61
66
|
end
|
|
62
67
|
end
|
|
63
68
|
|
|
69
|
+
--[=[
|
|
70
|
+
The current state.
|
|
71
|
+
@readonly
|
|
72
|
+
@prop CameraState CameraState
|
|
73
|
+
@within FadeBetweenCamera2
|
|
74
|
+
]=]
|
|
64
75
|
function FadeBetweenCamera2:__index(index)
|
|
65
76
|
if index == "CameraState" then
|
|
66
77
|
local state, _ = self:_computeCameraState(self:_computeDoneProportion(os.clock()))
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Add another layer of effects that can be faded in/out
|
|
3
|
+
@class FadeBetweenCamera3
|
|
4
|
+
]=]
|
|
3
5
|
|
|
4
6
|
local require = require(script.Parent.loader).load(script)
|
|
5
7
|
|
|
@@ -15,6 +17,11 @@ local CubicSplineUtils = require("CubicSplineUtils")
|
|
|
15
17
|
local FadeBetweenCamera3 = {}
|
|
16
18
|
FadeBetweenCamera3.ClassName = "FadeBetweenCamera3"
|
|
17
19
|
|
|
20
|
+
--[=[
|
|
21
|
+
@param cameraA CameraLike
|
|
22
|
+
@param cameraB CameraLike
|
|
23
|
+
@return FadeBetweenCamera3
|
|
24
|
+
]=]
|
|
18
25
|
function FadeBetweenCamera3.new(cameraA, cameraB)
|
|
19
26
|
local self = setmetatable({
|
|
20
27
|
_spring = Spring.new(0);
|
|
@@ -50,6 +57,12 @@ function FadeBetweenCamera3:__newindex(index, value)
|
|
|
50
57
|
end
|
|
51
58
|
end
|
|
52
59
|
|
|
60
|
+
--[=[
|
|
61
|
+
The current state.
|
|
62
|
+
@readonly
|
|
63
|
+
@prop CameraState CameraState
|
|
64
|
+
@within FadeBetweenCamera3
|
|
65
|
+
]=]
|
|
53
66
|
function FadeBetweenCamera3:__index(index)
|
|
54
67
|
if index == "CameraState" then
|
|
55
68
|
local _, t = SpringUtils.animating(self._spring)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
@class FadeBetweenCamera4
|
|
3
|
+
]=]
|
|
4
4
|
|
|
5
5
|
local require = require(script.Parent.loader).load(script)
|
|
6
6
|
|
|
@@ -13,6 +13,11 @@ local FadeBetweenCamera4 = {}
|
|
|
13
13
|
FadeBetweenCamera4.ClassName = "FadeBetweenCamera4"
|
|
14
14
|
FadeBetweenCamera4.__index = FadeBetweenCamera4
|
|
15
15
|
|
|
16
|
+
--[=[
|
|
17
|
+
@param cameraA CameraLike
|
|
18
|
+
@param cameraB CameraLike
|
|
19
|
+
@return FadeBetweenCamera4
|
|
20
|
+
]=]
|
|
16
21
|
function FadeBetweenCamera4.new(cameraA, cameraB)
|
|
17
22
|
local self = setmetatable({
|
|
18
23
|
CameraA = cameraA or error("No cameraA");
|
|
@@ -57,6 +62,12 @@ function FadeBetweenCamera4:__newindex(index, value)
|
|
|
57
62
|
end
|
|
58
63
|
end
|
|
59
64
|
|
|
65
|
+
--[=[
|
|
66
|
+
The current state.
|
|
67
|
+
@readonly
|
|
68
|
+
@prop CameraState CameraState
|
|
69
|
+
@within FadeBetweenCamera4
|
|
70
|
+
]=]
|
|
60
71
|
function FadeBetweenCamera4:__index(index)
|
|
61
72
|
if index == "CameraState" then
|
|
62
73
|
local _, value = SpringUtils.animating(self._spring)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Add another layer of effects that can be faded in/out
|
|
3
|
+
@class FadingCamera
|
|
4
|
+
]=]
|
|
3
5
|
|
|
4
6
|
local require = require(script.Parent.loader).load(script)
|
|
5
7
|
|
|
@@ -9,6 +11,9 @@ local SummedCamera = require("SummedCamera")
|
|
|
9
11
|
local FadingCamera = {}
|
|
10
12
|
FadingCamera.ClassName = "FadingCamera"
|
|
11
13
|
|
|
14
|
+
--[=[
|
|
15
|
+
@param camera CameraEffect
|
|
16
|
+
]=]
|
|
12
17
|
function FadingCamera.new(camera)
|
|
13
18
|
local self = setmetatable({}, FadingCamera)
|
|
14
19
|
|
|
@@ -41,6 +46,12 @@ function FadingCamera:__newindex(index, value)
|
|
|
41
46
|
end
|
|
42
47
|
end
|
|
43
48
|
|
|
49
|
+
--[=[
|
|
50
|
+
The current state.
|
|
51
|
+
@readonly
|
|
52
|
+
@prop CameraState CameraState
|
|
53
|
+
@within FadingCamera
|
|
54
|
+
]=]
|
|
44
55
|
function FadingCamera:__index(index)
|
|
45
56
|
if index == "CameraState" then
|
|
46
57
|
return (self.Camera.CameraState or self.Camera) * self.Spring.Value
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
--
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Update on heartbeat, must GC this camera state, unlike others. This
|
|
3
|
+
allows for camera effects to run on heartbeat and cache information once instead
|
|
4
|
+
of potentially going deeep into a tree and getting invoked multiple times
|
|
5
|
+
|
|
6
|
+
@class HeartbeatCamera
|
|
7
|
+
]=]
|
|
5
8
|
|
|
6
9
|
local require = require(script.Parent.loader).load(script)
|
|
7
10
|
|
|
@@ -38,6 +41,12 @@ function HeartbeatCamera:ForceUpdateCache()
|
|
|
38
41
|
self._currentStateCache = self._camera.CameraState
|
|
39
42
|
end
|
|
40
43
|
|
|
44
|
+
--[=[
|
|
45
|
+
The current state.
|
|
46
|
+
@readonly
|
|
47
|
+
@prop CameraState CameraState
|
|
48
|
+
@within DefaultCamera
|
|
49
|
+
]=]
|
|
41
50
|
function HeartbeatCamera:__index(index)
|
|
42
51
|
if index == "CameraState" then
|
|
43
52
|
return self._currentStateCache
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Add another layer of effects over any other camera by allowing an "impulse"
|
|
3
|
+
to be applied. Good for shockwaves, camera shake, and recoil.
|
|
4
|
+
|
|
5
|
+
@class ImpulseCamera
|
|
6
|
+
]=]
|
|
4
7
|
|
|
5
8
|
local require = require(script.Parent.loader).load(script)
|
|
6
9
|
|
|
@@ -22,6 +25,10 @@ function ImpulseCamera.new()
|
|
|
22
25
|
return self
|
|
23
26
|
end
|
|
24
27
|
|
|
28
|
+
--[=[
|
|
29
|
+
Applies an impulse to the camera, shaking it!
|
|
30
|
+
@param velocity Vector3
|
|
31
|
+
]=]
|
|
25
32
|
function ImpulseCamera:Impulse(velocity)
|
|
26
33
|
assert(typeof(velocity) == "Vector3", "Bad velocity")
|
|
27
34
|
|
|
@@ -44,6 +51,12 @@ function ImpulseCamera:__newindex(index, value)
|
|
|
44
51
|
end
|
|
45
52
|
end
|
|
46
53
|
|
|
54
|
+
--[=[
|
|
55
|
+
The current state.
|
|
56
|
+
@readonly
|
|
57
|
+
@prop CameraState CameraState
|
|
58
|
+
@within DefaultCamera
|
|
59
|
+
]=]
|
|
47
60
|
function ImpulseCamera:__index(index)
|
|
48
61
|
if index == "CameraState" then
|
|
49
62
|
local newState = CameraState.new()
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Be the inverse of a fading camera (makes scaling in cameras easy).
|
|
3
|
+
@class InverseFader
|
|
4
|
+
]=]
|
|
3
5
|
|
|
4
6
|
local require = require(script.Parent.loader).load(script)
|
|
5
7
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Point a current element but lag behind for a smoother experience
|
|
3
|
+
@class LagPointCamera
|
|
4
|
+
]=]
|
|
3
5
|
|
|
4
6
|
local require = require(script.Parent.loader).load(script)
|
|
5
7
|
|
|
@@ -12,7 +14,7 @@ LagPointCamera.ClassName = "LagPointCamera"
|
|
|
12
14
|
LagPointCamera._FocusCamera = nil
|
|
13
15
|
LagPointCamera._OriginCamera = nil
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
--
|
|
16
18
|
-- @constructor
|
|
17
19
|
-- @param originCamera A camera to use
|
|
18
20
|
-- @param focusCamera The Camera to look at.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Point a current element
|
|
3
|
+
@class PointCamera
|
|
4
|
+
]=]
|
|
3
5
|
|
|
4
6
|
local require = require(script.Parent.loader).load(script)
|
|
5
7
|
|
|
@@ -9,10 +11,12 @@ local SummedCamera = require("SummedCamera")
|
|
|
9
11
|
local PointCamera = {}
|
|
10
12
|
PointCamera.ClassName = "PointCamera"
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
--[=[
|
|
15
|
+
Initializes a new PointCamera
|
|
16
|
+
|
|
17
|
+
@param originCamera Camera -- A camera to use
|
|
18
|
+
@param focusCamera Camera -- The Camera to look at.
|
|
19
|
+
]=]
|
|
16
20
|
function PointCamera.new(originCamera, focusCamera)
|
|
17
21
|
local self = setmetatable({}, PointCamera)
|
|
18
22
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Like a rotated camera, except we end up pushing back to a default rotation.
|
|
3
|
+
This same behavior is seen in Roblox vehicle seats
|
|
4
|
+
|
|
5
|
+
@class PushCamera
|
|
6
|
+
]=]
|
|
4
7
|
|
|
5
8
|
local require = require(script.Parent.loader).load(script)
|
|
6
9
|
|
|
@@ -22,6 +25,10 @@ PushCamera.DefaultAngleXZ0 = 0
|
|
|
22
25
|
PushCamera._lastUpdateTime = -1
|
|
23
26
|
PushCamera.PushBackAfter = 0.5
|
|
24
27
|
|
|
28
|
+
--[=[
|
|
29
|
+
Constructs a new PushCamera
|
|
30
|
+
@return PushCamera
|
|
31
|
+
]=]
|
|
25
32
|
function PushCamera.new()
|
|
26
33
|
local self = setmetatable({}, PushCamera)
|
|
27
34
|
|
|
@@ -31,18 +38,24 @@ end
|
|
|
31
38
|
function PushCamera:__add(other)
|
|
32
39
|
return SummedCamera.new(self, other)
|
|
33
40
|
end
|
|
34
|
-
|
|
41
|
+
|
|
35
42
|
-- @param xzrotVector Vector2, the delta rotation to apply
|
|
36
43
|
function PushCamera:RotateXY(xzrotVector)
|
|
37
44
|
self.AngleX = self.AngleX + xzrotVector.x
|
|
38
45
|
self.AngleY = self.AngleY + xzrotVector.y
|
|
39
46
|
end
|
|
40
47
|
|
|
48
|
+
--[=[
|
|
49
|
+
Prevents the rotation back. You need to call this
|
|
50
|
+
every frame you want to prevent rotation.
|
|
51
|
+
]=]
|
|
41
52
|
function PushCamera:StopRotateBack()
|
|
42
53
|
self.CFrame = self.CFrame
|
|
43
54
|
end
|
|
44
55
|
|
|
45
|
-
|
|
56
|
+
--[=[
|
|
57
|
+
Resets to default position automatically
|
|
58
|
+
]=]
|
|
46
59
|
function PushCamera:Reset()
|
|
47
60
|
self.LastUpdateTime = 0
|
|
48
61
|
end
|
|
@@ -82,6 +95,12 @@ function PushCamera:__newindex(index, value)
|
|
|
82
95
|
end
|
|
83
96
|
end
|
|
84
97
|
|
|
98
|
+
--[=[
|
|
99
|
+
The current state.
|
|
100
|
+
@readonly
|
|
101
|
+
@prop CameraState CameraState
|
|
102
|
+
@within PushCamera
|
|
103
|
+
]=]
|
|
85
104
|
function PushCamera:__index(index)
|
|
86
105
|
if index == "CameraState" then
|
|
87
106
|
local state = CameraState.new()
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Allow freedom of movement around a current place, much like the classic script works now.
|
|
3
|
+
Not intended to be use with the current character script. This is the rotation component.
|
|
4
|
+
Intended to be used with a SummedCamera, relative.
|
|
5
|
+
|
|
6
|
+
@class RotatedCamera
|
|
7
|
+
]=]
|
|
5
8
|
|
|
6
9
|
local require = require(script.Parent.loader).load(script)
|
|
7
10
|
|
|
@@ -18,6 +21,10 @@ RotatedCamera._minY = math.rad(-80)
|
|
|
18
21
|
RotatedCamera._angleXZ = 0
|
|
19
22
|
RotatedCamera._angleY = 0
|
|
20
23
|
|
|
24
|
+
--[=[
|
|
25
|
+
Constructs a new RotatedCamera
|
|
26
|
+
@return RotatedCamera
|
|
27
|
+
]=]
|
|
21
28
|
function RotatedCamera.new()
|
|
22
29
|
local self = setmetatable({}, RotatedCamera)
|
|
23
30
|
|
|
@@ -28,7 +35,6 @@ function RotatedCamera:__add(other)
|
|
|
28
35
|
return SummedCamera.new(self, other)
|
|
29
36
|
end
|
|
30
37
|
|
|
31
|
-
---
|
|
32
38
|
-- @param xzrotvector Vector2, the delta rotation to apply
|
|
33
39
|
function RotatedCamera:RotateXY(xzrotvector)
|
|
34
40
|
self.AngleX = self.AngleX + xzrotvector.x
|
|
@@ -61,6 +67,12 @@ function RotatedCamera:__newindex(index, value)
|
|
|
61
67
|
end
|
|
62
68
|
end
|
|
63
69
|
|
|
70
|
+
--[=[
|
|
71
|
+
The current state.
|
|
72
|
+
@readonly
|
|
73
|
+
@prop CameraState CameraState
|
|
74
|
+
@within RotatedCamera
|
|
75
|
+
]=]
|
|
64
76
|
function RotatedCamera:__index(index)
|
|
65
77
|
if index == "CameraState" then
|
|
66
78
|
local state = CameraState.new()
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Lags the camera smoothly behind the position maintaining other components
|
|
3
|
+
@class SmoothPositionCamera
|
|
4
|
+
]=]
|
|
3
5
|
|
|
4
6
|
local require = require(script.Parent.loader).load(script)
|
|
5
7
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Allow freedom of movement around a current place, much like the classic script works now.
|
|
3
|
+
Not intended to be use with the current character script. This is the rotation component.
|
|
4
|
+
Intended to be used with a SummedCamera, relative.
|
|
5
|
+
|
|
6
|
+
@class SmoothRotatedCamera
|
|
7
|
+
]=]
|
|
5
8
|
|
|
6
9
|
local require = require(script.Parent.loader).load(script)
|
|
7
10
|
|
|
@@ -32,7 +35,6 @@ function SmoothRotatedCamera:__add(other)
|
|
|
32
35
|
return SummedCamera.new(self, other)
|
|
33
36
|
end
|
|
34
37
|
|
|
35
|
-
---
|
|
36
38
|
-- @param xyRotateVector Vector2, the delta rotation to apply
|
|
37
39
|
function SmoothRotatedCamera:RotateXY(xyRotateVector)
|
|
38
40
|
self.AngleX = self.AngleX + xyRotateVector.x
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Allow freedom of movement around a current place, much like the classic script works now.
|
|
3
|
+
Not intended to be use with the current character script
|
|
4
|
+
Intended to be used with a SummedCamera, relative.
|
|
5
|
+
|
|
6
|
+
@class SmoothZoomedCamera
|
|
7
|
+
]=]
|
|
5
8
|
|
|
6
9
|
local require = require(script.Parent.loader).load(script)
|
|
7
10
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Add two cameras together
|
|
3
|
+
@class SummedCamera
|
|
4
|
+
]=]
|
|
3
5
|
|
|
4
6
|
local require = require(script.Parent.loader).load(script)
|
|
5
7
|
|
|
@@ -10,10 +12,13 @@ local CameraFrame = require("CameraFrame")
|
|
|
10
12
|
local SummedCamera = {}
|
|
11
13
|
SummedCamera.ClassName = "SummedCamera"
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
--[=[
|
|
16
|
+
Construct a new summed camera
|
|
17
|
+
|
|
18
|
+
@param cameraA CameraEffect -- A CameraState or another CameraEffect to be used
|
|
19
|
+
@param cameraB CameraEffect -- A CameraState or another CameraEffect to be used
|
|
20
|
+
@return SummedCamera
|
|
21
|
+
]=]
|
|
17
22
|
function SummedCamera.new(cameraA, cameraB)
|
|
18
23
|
local self = setmetatable({}, SummedCamera)
|
|
19
24
|
|
|
@@ -24,10 +29,13 @@ function SummedCamera.new(cameraA, cameraB)
|
|
|
24
29
|
return self
|
|
25
30
|
end
|
|
26
31
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
--[=[
|
|
33
|
+
Sets the summation mode. If "World", then it just adds positions.
|
|
34
|
+
If "Relative", then it moves position relative to cameraA's CFrame.
|
|
35
|
+
|
|
36
|
+
@param mode "World" | "Relative" -- Mode to set
|
|
37
|
+
@return SummedCamera
|
|
38
|
+
]=]
|
|
31
39
|
function SummedCamera:SetMode(mode)
|
|
32
40
|
assert(mode == "World" or mode == "Relative", "Bad mode")
|
|
33
41
|
self._mode = mode
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Track a current part, whether it be a model or part
|
|
3
|
+
@class TrackCamera
|
|
4
|
+
]=]
|
|
3
5
|
|
|
4
6
|
local require = require(script.Parent.loader).load(script)
|
|
5
7
|
|
|
@@ -10,9 +12,12 @@ local TrackCamera = {}
|
|
|
10
12
|
TrackCamera.ClassName = "TrackCamera"
|
|
11
13
|
TrackCamera.FieldOfView = 0
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
--[=[
|
|
16
|
+
Constructs a new TrackCamera
|
|
17
|
+
|
|
18
|
+
@param cameraSubject Instance? -- The CameraSubject to look at. A Roblox part of Roblox model
|
|
19
|
+
@return TrackCamera
|
|
20
|
+
]=]
|
|
16
21
|
function TrackCamera.new(cameraSubject)
|
|
17
22
|
local self = setmetatable({}, TrackCamera)
|
|
18
23
|
|
|
@@ -39,9 +44,25 @@ function TrackCamera:__newindex(index, value)
|
|
|
39
44
|
end
|
|
40
45
|
end
|
|
41
46
|
|
|
47
|
+
--[=[
|
|
48
|
+
The current state.
|
|
49
|
+
@readonly
|
|
50
|
+
@prop CameraState CameraState
|
|
51
|
+
@within TrackCamera
|
|
52
|
+
]=]
|
|
53
|
+
--[=[
|
|
54
|
+
The current field of view.
|
|
55
|
+
@prop FieldOfView number
|
|
56
|
+
@within TrackCamera
|
|
57
|
+
]=]
|
|
58
|
+
--[=[
|
|
59
|
+
The current field of view.
|
|
60
|
+
@prop CameraSubject Instance
|
|
61
|
+
@within TrackCamera
|
|
62
|
+
]=]
|
|
63
|
+
|
|
42
64
|
function TrackCamera:__index(index)
|
|
43
65
|
if index == "CameraState" then
|
|
44
|
-
|
|
45
66
|
local state = CameraState.new()
|
|
46
67
|
state.FieldOfView = self.FieldOfView
|
|
47
68
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Lock camera to only XZPlane, preventing TrackerCameras from making players sick.
|
|
3
|
+
@class XZPlaneLockCamera
|
|
4
|
+
]=]
|
|
3
5
|
|
|
4
6
|
local require = require(script.Parent.loader).load(script)
|
|
5
7
|
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Allow freedom of movement around a current place, much like the classic script works now.
|
|
3
|
+
Not intended to be use with the current character script
|
|
4
|
+
Intended to be used with a SummedCamera, relative.
|
|
5
|
+
|
|
6
|
+
```lua
|
|
7
|
+
local zoom = ZoomedCamera.new()
|
|
8
|
+
zoom.Zoom = 30 -- Distance from original point
|
|
9
|
+
zoom.MaxZoom = 100 -- max distance away
|
|
10
|
+
zoom.MinZoom = 0.5 -- min distance away
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Assigning .Zoom will automatically clamp
|
|
14
|
+
|
|
15
|
+
@class ZoomedCamera
|
|
16
|
+
]=]
|
|
11
17
|
|
|
12
18
|
local require = require(script.Parent.loader).load(script)
|
|
13
19
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Utility methods involving touch input and cameras.
|
|
3
|
+
@class CameraTouchInputUtils
|
|
4
|
+
]=]
|
|
4
5
|
|
|
5
6
|
local CameraTouchInputUtils = {}
|
|
6
7
|
|
|
@@ -15,8 +16,15 @@ local TOUCH_ADJUST_AREA_DOWN = math.rad(-15)
|
|
|
15
16
|
local TOUCH_SENSITIVTY_ADJUST_MAX_Y = 2.1
|
|
16
17
|
local TOUCH_SENSITIVTY_ADJUST_MIN_Y = 0.5
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
--[=[
|
|
20
|
+
Adjusts the camera Y touch Sensitivity when moving away from the center and in the TOUCH_SENSITIVTY_ADJUST_AREA
|
|
21
|
+
Straight from Roblox's code
|
|
22
|
+
|
|
23
|
+
@param currPitchAngle number
|
|
24
|
+
@param sensitivity Vector2
|
|
25
|
+
@param delta Vector2
|
|
26
|
+
Return Vector2
|
|
27
|
+
]=]
|
|
20
28
|
function CameraTouchInputUtils.adjustTouchSensitivity(currPitchAngle, sensitivity, delta)
|
|
21
29
|
local multiplierY = TOUCH_SENSITIVTY_ADJUST_MAX_Y
|
|
22
30
|
if currPitchAngle > TOUCH_ADJUST_AREA_UP and delta.Y < 0 then
|