@quenty/camera 9.5.0 → 9.6.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
+ # [9.6.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/camera@9.5.0...@quenty/camera@9.6.0) (2022-12-06)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add :SetAcceleration(acceleration) on GamepadRotateModel to allow for a more linear control of the camera ([3aec535](https://github.com/Quenty/NevermoreEngine/commit/3aec535dc88ed97ff4762e4b50d6e46d4c6c6ecb))
12
+
13
+
14
+
15
+
16
+
6
17
  # [9.5.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/camera@9.4.0...@quenty/camera@9.5.0) (2022-11-19)
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": "9.5.0",
3
+ "version": "9.6.0",
4
4
  "description": "Quenty's camera system for Roblox",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -27,14 +27,14 @@
27
27
  "dependencies": {
28
28
  "@quenty/acceltween": "^2.2.1",
29
29
  "@quenty/baseobject": "^6.0.1",
30
- "@quenty/cframeutils": "^5.0.0",
30
+ "@quenty/cframeutils": "^5.1.0",
31
31
  "@quenty/cubicspline": "^6.0.1",
32
32
  "@quenty/inputobjectutils": "^4.0.0",
33
33
  "@quenty/loader": "^6.0.1",
34
34
  "@quenty/maid": "^2.4.0",
35
35
  "@quenty/math": "^2.2.0",
36
36
  "@quenty/qframe": "^6.1.1",
37
- "@quenty/servicebag": "^6.3.0",
37
+ "@quenty/servicebag": "^6.4.0",
38
38
  "@quenty/spring": "^6.0.1"
39
39
  },
40
40
  "devDependencies": {
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "2114f42ae399a4417a3ebd4d35bf481690ca7923"
46
+ "gitHead": "d9b0d10faa443cc42a6c2ac966f2f56d124bbde5"
47
47
  }
@@ -66,6 +66,16 @@ function CameraControls.new(zoomCamera, rotatedCamera)
66
66
  return self
67
67
  end
68
68
 
69
+ --[=[
70
+ Sets the gamepad rotation acceleration
71
+ @param acceleration number
72
+ ]=]
73
+ function CameraControls:SetGamepadRotationAcceleration(acceleration)
74
+ assert(type(acceleration) == "number", "Bad acceleration")
75
+
76
+ self._gamepadRotateModel:SetAcceleration(acceleration)
77
+ end
78
+
69
79
  function CameraControls:GetKey()
70
80
  return self._key
71
81
  end
@@ -74,6 +84,9 @@ function CameraControls:IsEnabled()
74
84
  return self._enabled
75
85
  end
76
86
 
87
+ --[=[
88
+ Enables the control.
89
+ ]=]
77
90
  function CameraControls:Enable()
78
91
  if self._enabled then
79
92
  return
@@ -119,6 +132,9 @@ function CameraControls:Enable()
119
132
  end)
120
133
  end
121
134
 
135
+ --[=[
136
+ Disables the control.
137
+ ]=]
122
138
  function CameraControls:Disable()
123
139
  if not self._enabled then
124
140
  return
@@ -1,5 +1,6 @@
1
1
  --[=[
2
- Rotation model for gamepad controls
2
+ Rotation model for gamepad controls that uses Roblox's curve smoothing and other components.
3
+
3
4
  @class GamepadRotateModel
4
5
  ]=]
5
6
 
@@ -13,6 +14,10 @@ local GamepadRotateModel = setmetatable({}, BaseObject)
13
14
  GamepadRotateModel.__index = GamepadRotateModel
14
15
  GamepadRotateModel.ClassName = "GamepadRotateModel"
15
16
 
17
+ --[=[
18
+ Constructs a new GamepadRotateModel.
19
+ @return GamepadRotateModel
20
+ ]=]
16
21
  function GamepadRotateModel.new()
17
22
  local self = setmetatable(BaseObject.new(), GamepadRotateModel)
18
23
 
@@ -26,6 +31,27 @@ function GamepadRotateModel.new()
26
31
  return self
27
32
  end
28
33
 
34
+ --[=[
35
+ Sets the acceleration for the game rotate model. The higher the acceleration
36
+ the more linear the gamepad rotate model feels.
37
+
38
+ :::tip
39
+ Set this to something high, like 2500, for an FPS. This makes control feel a lot better.
40
+ :::
41
+
42
+ @param acceleration number
43
+ ]=]
44
+ function GamepadRotateModel:SetAcceleration(acceleration)
45
+ assert(type(acceleration) == "number", "Bad acceleration")
46
+
47
+ self._rampVelocityX.a = acceleration
48
+ self._rampVelocityY.a = acceleration
49
+ end
50
+
51
+ --[=[
52
+ Gets the delta for the thumbstick
53
+ @return Vector2
54
+ ]=]
29
55
  function GamepadRotateModel:GetThumbstickDeltaAngle()
30
56
  if not self._lastInputObject then
31
57
  return Vector2.new()
@@ -34,6 +60,9 @@ function GamepadRotateModel:GetThumbstickDeltaAngle()
34
60
  return Vector2.new(self._rampVelocityX.p, self._rampVelocityY.p)
35
61
  end
36
62
 
63
+ --[=[
64
+ Stops rotation
65
+ ]=]
37
66
  function GamepadRotateModel:StopRotate()
38
67
  self._lastInputObject = nil
39
68
  self._rampVelocityX.t = 0
@@ -45,6 +74,12 @@ function GamepadRotateModel:StopRotate()
45
74
  self.IsRotating.Value = false
46
75
  end
47
76
 
77
+ --[=[
78
+ Converts the thumbstick input into a smoothed delta based upon deadzone and other
79
+ components.
80
+
81
+ @param inputObject InputObject
82
+ ]=]
48
83
  function GamepadRotateModel:HandleThumbstickInput(inputObject)
49
84
  if CameraGamepadInputUtils.outOfDeadZone(inputObject) then
50
85
  self._lastInputObject = inputObject