Skip to content

Commit 233a2ec

Browse files
committed
Input and Camera tweaking
1 parent 78dcc42 commit 233a2ec

File tree

7 files changed

+76
-27
lines changed

7 files changed

+76
-27
lines changed

UOP1_Project/Assets/Prefabs/GameplayEssentials/CameraSystem.prefab

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ MonoBehaviour:
5858
m_Script: {fileID: 11500000, guid: 9384ab8608cdc3d479fe89cd51eed48f, type: 3}
5959
m_Name:
6060
m_EditorClassIdentifier:
61-
m_BindingMode: 4
61+
m_BindingMode: 5
6262
m_FollowOffset: {x: 0, y: 7, z: -12}
6363
m_XDamping: 1
6464
m_YDamping: 1
@@ -168,7 +168,7 @@ Transform:
168168
m_PrefabInstance: {fileID: 0}
169169
m_PrefabAsset: {fileID: 0}
170170
m_GameObject: {fileID: 1988373824387590796}
171-
m_LocalRotation: {x: 0.22975291, y: 1e-45, z: -0, w: 0.973249}
171+
m_LocalRotation: {x: 0.22975291, y: -0, z: -0, w: 0.973249}
172172
m_LocalPosition: {x: 0, y: 0, z: 0}
173173
m_LocalScale: {x: 1, y: 1, z: 1}
174174
m_Children:
@@ -276,7 +276,7 @@ MonoBehaviour:
276276
m_Script: {fileID: 11500000, guid: 9384ab8608cdc3d479fe89cd51eed48f, type: 3}
277277
m_Name:
278278
m_EditorClassIdentifier:
279-
m_BindingMode: 4
279+
m_BindingMode: 5
280280
m_FollowOffset: {x: 0, y: 7, z: -12}
281281
m_XDamping: 0.1
282282
m_YDamping: 0.1
@@ -416,7 +416,7 @@ Transform:
416416
m_PrefabInstance: {fileID: 0}
417417
m_PrefabAsset: {fileID: 0}
418418
m_GameObject: {fileID: 5457523176376150323}
419-
m_LocalRotation: {x: 0.22975291, y: 1e-45, z: -0, w: 0.973249}
419+
m_LocalRotation: {x: 0.22975291, y: -9.602319e-22, z: 2.8636668e-22, w: 0.973249}
420420
m_LocalPosition: {x: 0, y: 0, z: 0}
421421
m_LocalScale: {x: 1, y: 1, z: 1}
422422
m_Children:
@@ -524,7 +524,7 @@ MonoBehaviour:
524524
m_Script: {fileID: 11500000, guid: 9384ab8608cdc3d479fe89cd51eed48f, type: 3}
525525
m_Name:
526526
m_EditorClassIdentifier:
527-
m_BindingMode: 4
527+
m_BindingMode: 5
528528
m_FollowOffset: {x: 0, y: 7, z: -12}
529529
m_XDamping: 1
530530
m_YDamping: 1
@@ -634,7 +634,7 @@ Transform:
634634
m_PrefabInstance: {fileID: 0}
635635
m_PrefabAsset: {fileID: 0}
636636
m_GameObject: {fileID: 6333144650067166509}
637-
m_LocalRotation: {x: 0.22975291, y: 1e-45, z: -0, w: 0.973249}
637+
m_LocalRotation: {x: 0.22975291, y: -0, z: -0, w: 0.973249}
638638
m_LocalPosition: {x: 0, y: 0, z: 0}
639639
m_LocalScale: {x: 1, y: 1, z: 1}
640640
m_Children:
@@ -782,7 +782,7 @@ MonoBehaviour:
782782
inputReader: {fileID: 11400000, guid: 945ec0365077176418488737deed54be, type: 2}
783783
mainCamera: {fileID: 8745341642014614481}
784784
freeLookVCam: {fileID: 8745341641394998849}
785-
speed: 2
785+
_speedMultiplier: 1
786786
_cameraTransformAnchor: {fileID: 11400000, guid: bc205269957643647a8b5f98f028f9fb,
787787
type: 2}
788788
_frameObjectChannel: {fileID: 11400000, guid: 2723b3f59f7ede3498fe7e385d2bb6ee,
@@ -884,7 +884,7 @@ MonoBehaviour:
884884
m_XAxis:
885885
Value: 0
886886
m_SpeedMode: 0
887-
m_MaxSpeed: 3000
887+
m_MaxSpeed: 5000
888888
m_AccelTime: 0.5
889889
m_DecelTime: 0.1
890890
m_InputAxisName:
@@ -909,7 +909,7 @@ MonoBehaviour:
909909
m_RecenteringTime: 10
910910
m_LegacyHeadingDefinition: -1
911911
m_LegacyVelocityFilterStrength: -1
912-
m_BindingMode: 4
912+
m_BindingMode: 5
913913
m_SplineCurvature: 1
914914
m_Orbits:
915915
- m_Height: 15
@@ -980,7 +980,7 @@ Transform:
980980
m_PrefabInstance: {fileID: 0}
981981
m_PrefabAsset: {fileID: 0}
982982
m_GameObject: {fileID: 8745341642014614487}
983-
m_LocalRotation: {x: 0.22975294, y: 1e-45, z: -0, w: 0.973249}
983+
m_LocalRotation: {x: 0.22975294, y: -0, z: -0, w: 0.973249}
984984
m_LocalPosition: {x: 0, y: 7, z: -12}
985985
m_LocalScale: {x: 1, y: 1, z: 1}
986986
m_Children: []

UOP1_Project/Assets/Scripts/CameraManager.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ public class CameraManager : MonoBehaviour
1010
public CinemachineFreeLook freeLookVCam;
1111
private bool _isRMBPressed;
1212

13-
[SerializeField, Range(1f, 5f)]
14-
private float speed = default;
13+
[SerializeField, Range(.5f, 3f)]
14+
private float _speedMultiplier = 1f; //TODO: make this modifiable in the game settings
1515
[SerializeField] private TransformAnchor _cameraTransformAnchor = default;
1616

1717
[Header("Listening on channels")]
1818
[Tooltip("The CameraManager listens to this event, fired by objects in any scene, to adapt camera position")]
1919
[SerializeField] private TransformEventChannelSO _frameObjectChannel = default;
2020

2121

22-
private bool cameraMovementLock = false;
22+
private bool _cameraMovementLock = false;
2323

2424
public void SetupProtagonistVirtualCamera(Transform target)
2525
{
@@ -61,9 +61,9 @@ private void OnEnableMouseControlCamera()
6161

6262
IEnumerator DisableMouseControlForFrame()
6363
{
64-
cameraMovementLock = true;
64+
_cameraMovementLock = true;
6565
yield return new WaitForEndOfFrame();
66-
cameraMovementLock = false;
66+
_cameraMovementLock = false;
6767
}
6868

6969
private void OnDisableMouseControlCamera()
@@ -81,14 +81,16 @@ private void OnDisableMouseControlCamera()
8181

8282
private void OnCameraMove(Vector2 cameraMovement, bool isDeviceMouse)
8383
{
84-
if (cameraMovementLock)
84+
Debug.Log(cameraMovement);
85+
86+
if (_cameraMovementLock)
8587
return;
8688

8789
if (isDeviceMouse && !_isRMBPressed)
8890
return;
8991

90-
freeLookVCam.m_XAxis.m_InputAxisValue = cameraMovement.x * Time.smoothDeltaTime * speed * 0.2f;
91-
freeLookVCam.m_YAxis.m_InputAxisValue = cameraMovement.y * Time.smoothDeltaTime * speed * 0.2f;
92+
freeLookVCam.m_XAxis.m_InputAxisValue = cameraMovement.x * Time.smoothDeltaTime * _speedMultiplier;
93+
freeLookVCam.m_YAxis.m_InputAxisValue = cameraMovement.y * Time.smoothDeltaTime * _speedMultiplier;
9294
}
9395

9496
private void OnFrameObjectEvent(Transform value)

UOP1_Project/Assets/Scripts/Input/GameInput.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ public @GameInput()
372372
""id"": ""2b832572-50ef-4dba-aaeb-964ed1c854bb"",
373373
""path"": ""<Gamepad>/rightStick"",
374374
""interactions"": """",
375-
""processors"": ""ScaleVector2(x=2,y=2)"",
375+
""processors"": ""StickDeadzone,ScaleVector2(x=8,y=8)"",
376376
""groups"": ""KeyboardOrGamepad"",
377377
""action"": ""RotateCamera"",
378378
""isComposite"": false,
@@ -381,9 +381,9 @@ public @GameInput()
381381
{
382382
""name"": ""Keyboard TFGH"",
383383
""id"": ""8e17360e-f036-4963-93f6-05d14787dfb5"",
384-
""path"": ""2DVector"",
384+
""path"": ""2DVector(mode=1)"",
385385
""interactions"": """",
386-
""processors"": ""ScaleVector2(x=2,y=2)"",
386+
""processors"": ""ScaleVector2(x=8,y=8)"",
387387
""groups"": """",
388388
""action"": ""RotateCamera"",
389389
""isComposite"": true,
@@ -449,7 +449,7 @@ public @GameInput()
449449
""id"": ""88e5a69d-cf1d-43ce-b5ab-9db67f819255"",
450450
""path"": ""<Mouse>/delta"",
451451
""interactions"": """",
452-
""processors"": ""ScaleVector2"",
452+
""processors"": ""ScaleVector2(x=2,y=2)"",
453453
""groups"": ""KeyboardOrGamepad"",
454454
""action"": ""RotateCamera"",
455455
""isComposite"": false,
@@ -1100,6 +1100,11 @@ public @GameInput()
11001100
""devicePath"": ""<Keyboard>"",
11011101
""isOptional"": false,
11021102
""isOR"": false
1103+
},
1104+
{
1105+
""devicePath"": ""<Mouse>"",
1106+
""isOptional"": false,
1107+
""isOR"": false
11031108
}
11041109
]
11051110
}

UOP1_Project/Assets/Settings/Input/GameInput.inputactions

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@
359359
"id": "2b832572-50ef-4dba-aaeb-964ed1c854bb",
360360
"path": "<Gamepad>/rightStick",
361361
"interactions": "",
362-
"processors": "ScaleVector2(x=2,y=2)",
362+
"processors": "StickDeadzone,ScaleVector2(x=8,y=8)",
363363
"groups": "KeyboardOrGamepad",
364364
"action": "RotateCamera",
365365
"isComposite": false,
@@ -368,9 +368,9 @@
368368
{
369369
"name": "Keyboard TFGH",
370370
"id": "8e17360e-f036-4963-93f6-05d14787dfb5",
371-
"path": "2DVector",
371+
"path": "2DVector(mode=1)",
372372
"interactions": "",
373-
"processors": "ScaleVector2(x=2,y=2)",
373+
"processors": "ScaleVector2(x=8,y=8)",
374374
"groups": "",
375375
"action": "RotateCamera",
376376
"isComposite": true,
@@ -436,7 +436,7 @@
436436
"id": "88e5a69d-cf1d-43ce-b5ab-9db67f819255",
437437
"path": "<Mouse>/delta",
438438
"interactions": "",
439-
"processors": "ScaleVector2",
439+
"processors": "ScaleVector2(x=2,y=2)",
440440
"groups": "KeyboardOrGamepad",
441441
"action": "RotateCamera",
442442
"isComposite": false,
@@ -1087,6 +1087,11 @@
10871087
"devicePath": "<Keyboard>",
10881088
"isOptional": false,
10891089
"isOR": false
1090+
},
1091+
{
1092+
"devicePath": "<Mouse>",
1093+
"isOptional": false,
1094+
"isOR": false
10901095
}
10911096
]
10921097
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!114 &11400000
4+
MonoBehaviour:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInstance: {fileID: 0}
8+
m_PrefabAsset: {fileID: 0}
9+
m_GameObject: {fileID: 0}
10+
m_Enabled: 1
11+
m_EditorHideFlags: 0
12+
m_Script: {fileID: 11500000, guid: c46f07b5ed07e4e92aa78254188d3d10, type: 3}
13+
m_Name: InputSystem.inputsettings
14+
m_EditorClassIdentifier:
15+
m_SupportedDevices:
16+
- Keyboard
17+
- Mouse
18+
- Gamepad
19+
m_UpdateMode: 1
20+
m_CompensateForScreenOrientation: 1
21+
m_FilterNoiseOnCurrent: 0
22+
m_DefaultDeadzoneMin: 0.1
23+
m_DefaultDeadzoneMax: 1
24+
m_DefaultButtonPressPoint: 0.5
25+
m_DefaultTapTime: 0.2
26+
m_DefaultSlowTapTime: 0.5
27+
m_DefaultHoldTime: 0.4
28+
m_TapRadius: 5
29+
m_MultiTapDelayTime: 0.75

UOP1_Project/Assets/Settings/Input/InputSystem.inputsettings.asset.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UOP1_Project/ProjectSettings/EditorBuildSettings.asset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ EditorBuildSettings:
3232
m_configObjects:
3333
com.unity.addressableassets: {fileID: 11400000, guid: 758daf1c1b96e4978a5b9b3f5815abf1,
3434
type: 2}
35-
com.unity.input.settings: {fileID: 11400000, guid: d65f543d6791541829742d101f33aedb,
35+
com.unity.input.settings: {fileID: 11400000, guid: bf2387135d5fdc745b74293cd27573be,
3636
type: 2}
3737
com.unity.localization.settings: {fileID: 11400000, guid: 56b1c58ec65bd4151b3054a32d1f7b69,
3838
type: 2}

0 commit comments

Comments
 (0)