From 6593c276608cee088dcab36d4ebc5b21ebd56875 Mon Sep 17 00:00:00 2001 From: DAIKI Date: Fri, 28 Jun 2024 12:52:31 +0900 Subject: [PATCH 1/5] Merge camera packages. --- ...ameraControls.meta => CameraControls.meta} | 0 .../CHANGELOG.md | 0 .../CHANGELOG.md.meta | 0 .../Scripts.meta | 0 .../Scripts/Runtime.meta | 0 .../Scripts/Runtime/Controllers.meta} | 2 +- .../CameraControls.Controllers.asmdef} | 2 +- .../CameraControls.Controllers.asmdef.meta} | 0 .../Controllers}/FPSCameraController.cs | 2 +- .../Controllers}/FPSCameraController.cs.meta | 0 .../Controllers}/TPSCameraController.cs | 2 +- .../Controllers}/TPSCameraController.cs.meta | 0 .../package.json | 0 .../package.json.meta | 0 .../Assets/TPSCameraControls.meta | 8 ------ .../Assets/TPSCameraControls/CHANGELOG.md | 24 ---------------- .../TPSCameraControls/CHANGELOG.md.meta | 7 ----- .../TPSCameraControls/Scripts/Runtime.meta | 8 ------ .../Scripts/Runtime/TPSCameraControls.asmdef | 28 ------------------- .../Runtime/TPSCameraControls.asmdef.meta | 7 ----- .../Assets/TPSCameraControls/package.json | 20 ------------- .../TPSCameraControls/package.json.meta | 7 ----- 22 files changed, 4 insertions(+), 113 deletions(-) rename src/ActionGameCore/Assets/{FPSCameraControls.meta => CameraControls.meta} (100%) rename src/ActionGameCore/Assets/{FPSCameraControls => CameraControls}/CHANGELOG.md (100%) rename src/ActionGameCore/Assets/{FPSCameraControls => CameraControls}/CHANGELOG.md.meta (100%) rename src/ActionGameCore/Assets/{FPSCameraControls => CameraControls}/Scripts.meta (100%) rename src/ActionGameCore/Assets/{FPSCameraControls => CameraControls}/Scripts/Runtime.meta (100%) rename src/ActionGameCore/Assets/{TPSCameraControls/Scripts.meta => CameraControls/Scripts/Runtime/Controllers.meta} (77%) rename src/ActionGameCore/Assets/{FPSCameraControls/Scripts/Runtime/FPSCameraControls.asmdef => CameraControls/Scripts/Runtime/Controllers/CameraControls.Controllers.asmdef} (94%) rename src/ActionGameCore/Assets/{FPSCameraControls/Scripts/Runtime/FPSCameraControls.asmdef.meta => CameraControls/Scripts/Runtime/Controllers/CameraControls.Controllers.asmdef.meta} (100%) rename src/ActionGameCore/Assets/{FPSCameraControls/Scripts/Runtime => CameraControls/Scripts/Runtime/Controllers}/FPSCameraController.cs (99%) rename src/ActionGameCore/Assets/{FPSCameraControls/Scripts/Runtime => CameraControls/Scripts/Runtime/Controllers}/FPSCameraController.cs.meta (100%) rename src/ActionGameCore/Assets/{TPSCameraControls/Scripts/Runtime => CameraControls/Scripts/Runtime/Controllers}/TPSCameraController.cs (99%) rename src/ActionGameCore/Assets/{TPSCameraControls/Scripts/Runtime => CameraControls/Scripts/Runtime/Controllers}/TPSCameraController.cs.meta (100%) rename src/ActionGameCore/Assets/{FPSCameraControls => CameraControls}/package.json (100%) rename src/ActionGameCore/Assets/{FPSCameraControls => CameraControls}/package.json.meta (100%) delete mode 100644 src/ActionGameCore/Assets/TPSCameraControls.meta delete mode 100644 src/ActionGameCore/Assets/TPSCameraControls/CHANGELOG.md delete mode 100644 src/ActionGameCore/Assets/TPSCameraControls/CHANGELOG.md.meta delete mode 100644 src/ActionGameCore/Assets/TPSCameraControls/Scripts/Runtime.meta delete mode 100644 src/ActionGameCore/Assets/TPSCameraControls/Scripts/Runtime/TPSCameraControls.asmdef delete mode 100644 src/ActionGameCore/Assets/TPSCameraControls/Scripts/Runtime/TPSCameraControls.asmdef.meta delete mode 100644 src/ActionGameCore/Assets/TPSCameraControls/package.json delete mode 100644 src/ActionGameCore/Assets/TPSCameraControls/package.json.meta diff --git a/src/ActionGameCore/Assets/FPSCameraControls.meta b/src/ActionGameCore/Assets/CameraControls.meta similarity index 100% rename from src/ActionGameCore/Assets/FPSCameraControls.meta rename to src/ActionGameCore/Assets/CameraControls.meta diff --git a/src/ActionGameCore/Assets/FPSCameraControls/CHANGELOG.md b/src/ActionGameCore/Assets/CameraControls/CHANGELOG.md similarity index 100% rename from src/ActionGameCore/Assets/FPSCameraControls/CHANGELOG.md rename to src/ActionGameCore/Assets/CameraControls/CHANGELOG.md diff --git a/src/ActionGameCore/Assets/FPSCameraControls/CHANGELOG.md.meta b/src/ActionGameCore/Assets/CameraControls/CHANGELOG.md.meta similarity index 100% rename from src/ActionGameCore/Assets/FPSCameraControls/CHANGELOG.md.meta rename to src/ActionGameCore/Assets/CameraControls/CHANGELOG.md.meta diff --git a/src/ActionGameCore/Assets/FPSCameraControls/Scripts.meta b/src/ActionGameCore/Assets/CameraControls/Scripts.meta similarity index 100% rename from src/ActionGameCore/Assets/FPSCameraControls/Scripts.meta rename to src/ActionGameCore/Assets/CameraControls/Scripts.meta diff --git a/src/ActionGameCore/Assets/FPSCameraControls/Scripts/Runtime.meta b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime.meta similarity index 100% rename from src/ActionGameCore/Assets/FPSCameraControls/Scripts/Runtime.meta rename to src/ActionGameCore/Assets/CameraControls/Scripts/Runtime.meta diff --git a/src/ActionGameCore/Assets/TPSCameraControls/Scripts.meta b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers.meta similarity index 77% rename from src/ActionGameCore/Assets/TPSCameraControls/Scripts.meta rename to src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers.meta index ecfd8a2..77a7a3f 100644 --- a/src/ActionGameCore/Assets/TPSCameraControls/Scripts.meta +++ b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7b2d31485f23ea048a760dcf5dfe7c28 +guid: 3972ca2c6fb8dcf4abc232361747390c folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/src/ActionGameCore/Assets/FPSCameraControls/Scripts/Runtime/FPSCameraControls.asmdef b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/CameraControls.Controllers.asmdef similarity index 94% rename from src/ActionGameCore/Assets/FPSCameraControls/Scripts/Runtime/FPSCameraControls.asmdef rename to src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/CameraControls.Controllers.asmdef index 05c9004..9b231d5 100644 --- a/src/ActionGameCore/Assets/FPSCameraControls/Scripts/Runtime/FPSCameraControls.asmdef +++ b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/CameraControls.Controllers.asmdef @@ -1,5 +1,5 @@ { - "name": "FPSCameraControls", + "name": "CameraControls.Controllers", "rootNamespace": "", "references": [ "GUID:75469ad4d38634e559750d17036d5f7c", diff --git a/src/ActionGameCore/Assets/FPSCameraControls/Scripts/Runtime/FPSCameraControls.asmdef.meta b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/CameraControls.Controllers.asmdef.meta similarity index 100% rename from src/ActionGameCore/Assets/FPSCameraControls/Scripts/Runtime/FPSCameraControls.asmdef.meta rename to src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/CameraControls.Controllers.asmdef.meta diff --git a/src/ActionGameCore/Assets/FPSCameraControls/Scripts/Runtime/FPSCameraController.cs b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/FPSCameraController.cs similarity index 99% rename from src/ActionGameCore/Assets/FPSCameraControls/Scripts/Runtime/FPSCameraController.cs rename to src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/FPSCameraController.cs index 4e13e21..802a662 100644 --- a/src/ActionGameCore/Assets/FPSCameraControls/Scripts/Runtime/FPSCameraController.cs +++ b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/FPSCameraController.cs @@ -9,7 +9,7 @@ using Steamworks; #endif -namespace FPSCameraControls +namespace FPSCameraControls.Controllers { public class FPSCameraController : MonoBehaviour { diff --git a/src/ActionGameCore/Assets/FPSCameraControls/Scripts/Runtime/FPSCameraController.cs.meta b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/FPSCameraController.cs.meta similarity index 100% rename from src/ActionGameCore/Assets/FPSCameraControls/Scripts/Runtime/FPSCameraController.cs.meta rename to src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/FPSCameraController.cs.meta diff --git a/src/ActionGameCore/Assets/TPSCameraControls/Scripts/Runtime/TPSCameraController.cs b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/TPSCameraController.cs similarity index 99% rename from src/ActionGameCore/Assets/TPSCameraControls/Scripts/Runtime/TPSCameraController.cs rename to src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/TPSCameraController.cs index a557b6a..76eeec4 100644 --- a/src/ActionGameCore/Assets/TPSCameraControls/Scripts/Runtime/TPSCameraController.cs +++ b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/TPSCameraController.cs @@ -9,7 +9,7 @@ #if SUPPORT_STEAMWORKS && !DISABLESTEAMWORKS #endif -namespace FPSCameraControls +namespace FPSCameraControls.Controllers { public class TPSCameraController : MonoBehaviour { diff --git a/src/ActionGameCore/Assets/TPSCameraControls/Scripts/Runtime/TPSCameraController.cs.meta b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/TPSCameraController.cs.meta similarity index 100% rename from src/ActionGameCore/Assets/TPSCameraControls/Scripts/Runtime/TPSCameraController.cs.meta rename to src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/TPSCameraController.cs.meta diff --git a/src/ActionGameCore/Assets/FPSCameraControls/package.json b/src/ActionGameCore/Assets/CameraControls/package.json similarity index 100% rename from src/ActionGameCore/Assets/FPSCameraControls/package.json rename to src/ActionGameCore/Assets/CameraControls/package.json diff --git a/src/ActionGameCore/Assets/FPSCameraControls/package.json.meta b/src/ActionGameCore/Assets/CameraControls/package.json.meta similarity index 100% rename from src/ActionGameCore/Assets/FPSCameraControls/package.json.meta rename to src/ActionGameCore/Assets/CameraControls/package.json.meta diff --git a/src/ActionGameCore/Assets/TPSCameraControls.meta b/src/ActionGameCore/Assets/TPSCameraControls.meta deleted file mode 100644 index aa15edf..0000000 --- a/src/ActionGameCore/Assets/TPSCameraControls.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9e0965cb6b7cd0344ba2f60031488d70 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/src/ActionGameCore/Assets/TPSCameraControls/CHANGELOG.md b/src/ActionGameCore/Assets/TPSCameraControls/CHANGELOG.md deleted file mode 100644 index 6a5555b..0000000 --- a/src/ActionGameCore/Assets/TPSCameraControls/CHANGELOG.md +++ /dev/null @@ -1,24 +0,0 @@ -# Changelog - -## [1.3.0] - 2024-06-28 -### Changed -- Support SteamInput. - -## [1.2.0] - 2024-05-16 -### Changed -- Match camera sensitivity of mouse and controller. - - Rename and add serialized field for input action reference. - - Change default sensitivity to 1.0 - - Change calculation of camera angle. - -## [1.1.0] - 2024-03-06 -### Fixed -- Change parameter type of input to InputActionReference. - -## [1.0.1] - 2024-03-04 -### Fixed -- Show input action name to inspector. - -## [1.0.0] - 2024-03-03 -### Added -- Add camera rotation and wall check. diff --git a/src/ActionGameCore/Assets/TPSCameraControls/CHANGELOG.md.meta b/src/ActionGameCore/Assets/TPSCameraControls/CHANGELOG.md.meta deleted file mode 100644 index 2861ddf..0000000 --- a/src/ActionGameCore/Assets/TPSCameraControls/CHANGELOG.md.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: e13ef1822b65d0d45a9c23a978c76a6d -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/src/ActionGameCore/Assets/TPSCameraControls/Scripts/Runtime.meta b/src/ActionGameCore/Assets/TPSCameraControls/Scripts/Runtime.meta deleted file mode 100644 index 4c4ba53..0000000 --- a/src/ActionGameCore/Assets/TPSCameraControls/Scripts/Runtime.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 51185baaf78d46d42944ceef40d80954 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/src/ActionGameCore/Assets/TPSCameraControls/Scripts/Runtime/TPSCameraControls.asmdef b/src/ActionGameCore/Assets/TPSCameraControls/Scripts/Runtime/TPSCameraControls.asmdef deleted file mode 100644 index 8bb8aeb..0000000 --- a/src/ActionGameCore/Assets/TPSCameraControls/Scripts/Runtime/TPSCameraControls.asmdef +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "TPSCameraControls", - "rootNamespace": "", - "references": [ - "GUID:75469ad4d38634e559750d17036d5f7c", - "GUID:68bd7fdb68ef2684e982e8a9825b18a5" - ], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": false, - "defineConstraints": [], - "versionDefines": [ - { - "name": "com.unity.inputsystem", - "expression": "", - "define": "SUPPORT_INPUTSYSTEM" - }, - { - "name": "com.rlabrecque.steamworks.net", - "expression": "", - "define": "SUPPORT_STEAMWORKS" - } - ], - "noEngineReferences": false -} \ No newline at end of file diff --git a/src/ActionGameCore/Assets/TPSCameraControls/Scripts/Runtime/TPSCameraControls.asmdef.meta b/src/ActionGameCore/Assets/TPSCameraControls/Scripts/Runtime/TPSCameraControls.asmdef.meta deleted file mode 100644 index ceae6e4..0000000 --- a/src/ActionGameCore/Assets/TPSCameraControls/Scripts/Runtime/TPSCameraControls.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: bd05ab0e5cf3eac4fb241abe2a6779ea -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/src/ActionGameCore/Assets/TPSCameraControls/package.json b/src/ActionGameCore/Assets/TPSCameraControls/package.json deleted file mode 100644 index 6b72067..0000000 --- a/src/ActionGameCore/Assets/TPSCameraControls/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "com.eviltwo.tps-camera-controls", - "displayName": "TPS Camera Controls", - "version": "1.3.0", - "unity": "2022.3", - "description": "Camera movements for TPS.", - "author": { - "name": "DAIKI(eviltwo)", - "url": "https://github.com/eviltwo" - }, - - "keywords": [ - "Action", - "TPS", - "Camera" - ], - - "dependencies": { - } -} \ No newline at end of file diff --git a/src/ActionGameCore/Assets/TPSCameraControls/package.json.meta b/src/ActionGameCore/Assets/TPSCameraControls/package.json.meta deleted file mode 100644 index 969f929..0000000 --- a/src/ActionGameCore/Assets/TPSCameraControls/package.json.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 232e6a4f0af961b4897c6c07c06ed4ef -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: From 30695633766d8bb139133c6bf3b519fdbc64fa72 Mon Sep 17 00:00:00 2001 From: DAIKI Date: Fri, 28 Jun 2024 12:52:42 +0900 Subject: [PATCH 2/5] Update settings --- .../ProjectSettings/QualitySettings.asset | 116 +++++++++++++++--- 1 file changed, 98 insertions(+), 18 deletions(-) diff --git a/src/ActionGameCore/ProjectSettings/QualitySettings.asset b/src/ActionGameCore/ProjectSettings/QualitySettings.asset index 7b7658d..e00aac0 100644 --- a/src/ActionGameCore/ProjectSettings/QualitySettings.asset +++ b/src/ActionGameCore/ProjectSettings/QualitySettings.asset @@ -6,7 +6,7 @@ QualitySettings: serializedVersion: 5 m_CurrentQuality: 5 m_QualitySettings: - - serializedVersion: 2 + - serializedVersion: 3 name: Very Low pixelLightCount: 0 shadows: 0 @@ -18,17 +18,20 @@ QualitySettings: shadowCascade2Split: 0.33333334 shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowmaskMode: 0 - blendWeights: 1 - textureQuality: 1 + skinWeights: 1 + globalTextureMipmapLimit: 1 + textureMipmapLimitSettings: [] anisotropicTextures: 0 antiAliasing: 0 softParticles: 0 softVegetation: 0 realtimeReflectionProbes: 0 billboardsFaceCameraPosition: 0 + useLegacyDetailDistribution: 1 vSyncCount: 0 lodBias: 0.3 maximumLODLevel: 0 + enableLODCrossFade: 1 streamingMipmapsActive: 0 streamingMipmapsAddAllCameras: 1 streamingMipmapsMemoryBudget: 512 @@ -40,8 +43,18 @@ QualitySettings: asyncUploadBufferSize: 16 asyncUploadPersistentBuffer: 1 resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} + terrainQualityOverrides: 0 + terrainPixelError: 1 + terrainDetailDensityScale: 1 + terrainBasemapDistance: 1000 + terrainDetailDistance: 80 + terrainTreeDistance: 5000 + terrainBillboardStart: 50 + terrainFadeLength: 5 + terrainMaxTrees: 50 excludedTargetPlatforms: [] - - serializedVersion: 2 + - serializedVersion: 3 name: Low pixelLightCount: 0 shadows: 0 @@ -53,17 +66,20 @@ QualitySettings: shadowCascade2Split: 0.33333334 shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowmaskMode: 0 - blendWeights: 2 - textureQuality: 0 + skinWeights: 2 + globalTextureMipmapLimit: 0 + textureMipmapLimitSettings: [] anisotropicTextures: 0 antiAliasing: 0 softParticles: 0 softVegetation: 0 realtimeReflectionProbes: 0 billboardsFaceCameraPosition: 0 + useLegacyDetailDistribution: 1 vSyncCount: 0 lodBias: 0.4 maximumLODLevel: 0 + enableLODCrossFade: 1 streamingMipmapsActive: 0 streamingMipmapsAddAllCameras: 1 streamingMipmapsMemoryBudget: 512 @@ -75,8 +91,18 @@ QualitySettings: asyncUploadBufferSize: 16 asyncUploadPersistentBuffer: 1 resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} + terrainQualityOverrides: 0 + terrainPixelError: 1 + terrainDetailDensityScale: 1 + terrainBasemapDistance: 1000 + terrainDetailDistance: 80 + terrainTreeDistance: 5000 + terrainBillboardStart: 50 + terrainFadeLength: 5 + terrainMaxTrees: 50 excludedTargetPlatforms: [] - - serializedVersion: 2 + - serializedVersion: 3 name: Medium pixelLightCount: 1 shadows: 1 @@ -88,17 +114,20 @@ QualitySettings: shadowCascade2Split: 0.33333334 shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowmaskMode: 0 - blendWeights: 2 - textureQuality: 0 + skinWeights: 2 + globalTextureMipmapLimit: 0 + textureMipmapLimitSettings: [] anisotropicTextures: 1 antiAliasing: 0 softParticles: 0 softVegetation: 0 realtimeReflectionProbes: 0 billboardsFaceCameraPosition: 0 + useLegacyDetailDistribution: 1 vSyncCount: 1 lodBias: 0.7 maximumLODLevel: 0 + enableLODCrossFade: 1 streamingMipmapsActive: 0 streamingMipmapsAddAllCameras: 1 streamingMipmapsMemoryBudget: 512 @@ -110,8 +139,18 @@ QualitySettings: asyncUploadBufferSize: 16 asyncUploadPersistentBuffer: 1 resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} + terrainQualityOverrides: 0 + terrainPixelError: 1 + terrainDetailDensityScale: 1 + terrainBasemapDistance: 1000 + terrainDetailDistance: 80 + terrainTreeDistance: 5000 + terrainBillboardStart: 50 + terrainFadeLength: 5 + terrainMaxTrees: 50 excludedTargetPlatforms: [] - - serializedVersion: 2 + - serializedVersion: 3 name: High pixelLightCount: 2 shadows: 2 @@ -123,17 +162,20 @@ QualitySettings: shadowCascade2Split: 0.33333334 shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowmaskMode: 1 - blendWeights: 2 - textureQuality: 0 + skinWeights: 2 + globalTextureMipmapLimit: 0 + textureMipmapLimitSettings: [] anisotropicTextures: 1 antiAliasing: 0 softParticles: 0 softVegetation: 1 realtimeReflectionProbes: 1 billboardsFaceCameraPosition: 1 + useLegacyDetailDistribution: 1 vSyncCount: 1 lodBias: 1 maximumLODLevel: 0 + enableLODCrossFade: 1 streamingMipmapsActive: 0 streamingMipmapsAddAllCameras: 1 streamingMipmapsMemoryBudget: 512 @@ -145,8 +187,18 @@ QualitySettings: asyncUploadBufferSize: 16 asyncUploadPersistentBuffer: 1 resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} + terrainQualityOverrides: 0 + terrainPixelError: 1 + terrainDetailDensityScale: 1 + terrainBasemapDistance: 1000 + terrainDetailDistance: 80 + terrainTreeDistance: 5000 + terrainBillboardStart: 50 + terrainFadeLength: 5 + terrainMaxTrees: 50 excludedTargetPlatforms: [] - - serializedVersion: 2 + - serializedVersion: 3 name: Very High pixelLightCount: 3 shadows: 2 @@ -158,17 +210,20 @@ QualitySettings: shadowCascade2Split: 0.33333334 shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowmaskMode: 1 - blendWeights: 4 - textureQuality: 0 + skinWeights: 4 + globalTextureMipmapLimit: 0 + textureMipmapLimitSettings: [] anisotropicTextures: 2 antiAliasing: 2 softParticles: 1 softVegetation: 1 realtimeReflectionProbes: 1 billboardsFaceCameraPosition: 1 + useLegacyDetailDistribution: 1 vSyncCount: 1 lodBias: 1.5 maximumLODLevel: 0 + enableLODCrossFade: 1 streamingMipmapsActive: 0 streamingMipmapsAddAllCameras: 1 streamingMipmapsMemoryBudget: 512 @@ -180,8 +235,18 @@ QualitySettings: asyncUploadBufferSize: 16 asyncUploadPersistentBuffer: 1 resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} + terrainQualityOverrides: 0 + terrainPixelError: 1 + terrainDetailDensityScale: 1 + terrainBasemapDistance: 1000 + terrainDetailDistance: 80 + terrainTreeDistance: 5000 + terrainBillboardStart: 50 + terrainFadeLength: 5 + terrainMaxTrees: 50 excludedTargetPlatforms: [] - - serializedVersion: 2 + - serializedVersion: 3 name: Ultra pixelLightCount: 4 shadows: 2 @@ -193,17 +258,20 @@ QualitySettings: shadowCascade2Split: 0.33333334 shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowmaskMode: 1 - blendWeights: 4 - textureQuality: 0 + skinWeights: 4 + globalTextureMipmapLimit: 0 + textureMipmapLimitSettings: [] anisotropicTextures: 2 antiAliasing: 2 softParticles: 1 softVegetation: 1 realtimeReflectionProbes: 1 billboardsFaceCameraPosition: 1 + useLegacyDetailDistribution: 1 vSyncCount: 1 lodBias: 2 maximumLODLevel: 0 + enableLODCrossFade: 1 streamingMipmapsActive: 0 streamingMipmapsAddAllCameras: 1 streamingMipmapsMemoryBudget: 512 @@ -215,7 +283,18 @@ QualitySettings: asyncUploadBufferSize: 16 asyncUploadPersistentBuffer: 1 resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} + terrainQualityOverrides: 0 + terrainPixelError: 1 + terrainDetailDensityScale: 1 + terrainBasemapDistance: 1000 + terrainDetailDistance: 80 + terrainTreeDistance: 5000 + terrainBillboardStart: 50 + terrainFadeLength: 5 + terrainMaxTrees: 50 excludedTargetPlatforms: [] + m_TextureMipmapLimitGroupNames: [] m_PerPlatformDefaultQuality: Android: 2 Lumin: 5 @@ -223,6 +302,7 @@ QualitySettings: Nintendo Switch: 5 PS4: 5 PSP2: 2 + Server: 0 Stadia: 5 Standalone: 5 WebGL: 3 From 3e971dff88d382e0a8829501b605cb7948748cf1 Mon Sep 17 00:00:00 2001 From: DAIKI Date: Fri, 28 Jun 2024 13:38:02 +0900 Subject: [PATCH 3/5] Separate camera script to controller and input. --- .../Controllers/FPSCameraController.cs | 144 ++--------------- .../Runtime/Controllers/ICameraController.cs | 10 ++ .../Controllers/ICameraController.cs.meta | 11 ++ .../Controllers/TPSCameraController.cs | 127 ++------------- .../Scripts/Runtime/Inputs.meta | 8 + .../Inputs/CameraControls.Inputs.asmdef | 29 ++++ .../Inputs/CameraControls.Inputs.asmdef.meta | 7 + .../Scripts/Runtime/Inputs/CameraInput.cs | 151 ++++++++++++++++++ .../Runtime/Inputs/CameraInput.cs.meta | 11 ++ .../Assets/Samples/Scenes/SampleScene.unity | 25 ++- 10 files changed, 268 insertions(+), 255 deletions(-) create mode 100644 src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/ICameraController.cs create mode 100644 src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/ICameraController.cs.meta create mode 100644 src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Inputs.meta create mode 100644 src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Inputs/CameraControls.Inputs.asmdef create mode 100644 src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Inputs/CameraControls.Inputs.asmdef.meta create mode 100644 src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Inputs/CameraInput.cs create mode 100644 src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Inputs/CameraInput.cs.meta diff --git a/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/FPSCameraController.cs b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/FPSCameraController.cs index 802a662..2e19614 100644 --- a/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/FPSCameraController.cs +++ b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/FPSCameraController.cs @@ -1,17 +1,8 @@ -using System.Collections.Generic; using UnityEngine; -#if SUPPORT_INPUTSYSTEM -using UnityEngine.InputSystem; -#endif - -#if SUPPORT_STEAMWORKS && !DISABLESTEAMWORKS -using Steamworks; -#endif - -namespace FPSCameraControls.Controllers +namespace CameraControls.Controllers { - public class FPSCameraController : MonoBehaviour + public class FPSCameraController : MonoBehaviour, ICameraController { [SerializeField] public Transform Target = null; @@ -34,53 +25,18 @@ public class FPSCameraController : MonoBehaviour [SerializeField] private bool _lockAndHideCursor = true; -#if SUPPORT_INPUTSYSTEM - [Header("InputSystem")] - [SerializeField] - private InputActionReference _deltaActionReference = null; - - [SerializeField] - private InputActionReference _continuousActionreference = null; -#endif - -#if SUPPORT_STEAMWORKS - [Header("SteamInput")] - [SerializeField] - private string _steamCameraActionName = "Camera"; -#endif + private Vector2 _deltaAngles; + private Vector3 _lookAngles; -#if SUPPORT_STEAMWORKS && !DISABLESTEAMWORKS - private bool _steamInitialized; - private InputAnalogActionHandle_t _steamCameraActionHandle; - private InputHandle_t[] _connectedControllerInputHandles = new InputHandle_t[Constants.STEAM_INPUT_MAX_COUNT]; -#endif + public bool Enabled => enabled; - private Vector3 _lookAngles; - private List _deltaPositions = new List(); - private List _deltaTimes = new List(); + public void SetDeltaAngles(Vector2 deltaAngles) + { + _deltaAngles = deltaAngles; + } private void Start() { -#if SUPPORT_INPUTSYSTEM - _deltaActionReference?.action.Enable(); - _continuousActionreference?.action.Enable(); -#endif - -#if SUPPORT_STEAMWORKS && !DISABLESTEAMWORKS - try - { - if (!string.IsNullOrEmpty(_steamCameraActionName)) - { - _steamCameraActionHandle = SteamInput.GetAnalogActionHandle(_steamCameraActionName); - } - _steamInitialized = true; - } - catch (System.Exception e) - { - Debug.LogError($"Failed to initialize Steam Input: {e.Message}"); - } -#endif - if (_lockAndHideCursor) { Cursor.visible = false; @@ -97,87 +53,11 @@ private void LateUpdate() var position = Target.position + new Vector3(0, OffsetY, 0); - var deltaAngle = Vector2.zero; - - var deltaPosition = Vector2.zero; - -#if SUPPORT_INPUTSYSTEM - if (_deltaActionReference != null) - { - var v = _deltaActionReference.action.ReadValue(); - deltaPosition = v.sqrMagnitude > deltaPosition.sqrMagnitude ? v : deltaPosition; - } -#endif - -#if SUPPORT_STEAMWORKS && !DISABLESTEAMWORKS - if (_steamInitialized && _steamCameraActionHandle != null) - { - var controllerCount = SteamInput.GetConnectedControllers(_connectedControllerInputHandles); - for (int i = 0; i < controllerCount; i++) - { - var inputHandle = _connectedControllerInputHandles[i]; - var data = SteamInput.GetAnalogActionData(inputHandle, _steamCameraActionHandle); - var v = new Vector2(data.x, -data.y); - deltaPosition = v.sqrMagnitude > deltaPosition.sqrMagnitude ? v : deltaPosition; - } - } -#endif - - { - _deltaPositions.Add(deltaPosition); - _deltaTimes.Add(Time.deltaTime); - SmoothingFrameCount = Mathf.Max(1, SmoothingFrameCount); - if (_deltaPositions.Count > SmoothingFrameCount) - { - _deltaPositions.RemoveRange(0, _deltaPositions.Count - SmoothingFrameCount); - _deltaTimes.RemoveRange(0, _deltaTimes.Count - SmoothingFrameCount); - } - var totalPosition = Vector2.zero; - var totalTime = 0f; - for (int i = 0; i < _deltaPositions.Count; i++) - { - totalPosition += _deltaPositions[i]; - totalTime += _deltaTimes[i]; - } - var deltaPositionAverage = totalPosition / totalTime; - var smoothDeltaPosition = deltaPositionAverage * Time.deltaTime; - - const float DpiAverage = 96; - var dpi = Screen.dpi == 0 ? DpiAverage : Screen.dpi; - const float InchForTurn = 13; - var v = smoothDeltaPosition / dpi / InchForTurn * 180; - deltaAngle = v.sqrMagnitude > deltaAngle.sqrMagnitude ? v : deltaAngle; - } - -#if SUPPORT_INPUTSYSTEM - if (_continuousActionreference != null) - { - const float SecondsForTurn = 1.0f; - var v = _continuousActionreference.action.ReadValue() * Time.deltaTime / SecondsForTurn * 180; - deltaAngle = v.sqrMagnitude > deltaAngle.sqrMagnitude ? v : deltaAngle; - } -#endif - - _lookAngles.x = Mathf.Clamp(_lookAngles.x - deltaAngle.y * Sensitivity, -AngleMax, -AngleMin); // Look up and down - _lookAngles.y = (_lookAngles.y + deltaAngle.x * Sensitivity) % 360; // Look left and right + _lookAngles.x = Mathf.Clamp(_lookAngles.x - _deltaAngles.y * Sensitivity, -AngleMax, -AngleMin); // Look up and down + _lookAngles.y = (_lookAngles.y + _deltaAngles.x * Sensitivity) % 360; // Look left and right var rotation = Quaternion.Euler(_lookAngles); - transform.SetPositionAndRotation(position, rotation); - } - - private void OnDrawGizmos() - { - if (!Application.isPlaying) - { - return; - } - Gizmos.color = Color.red; - for (int i = 0; i < _deltaPositions.Count; i++) - { - var d = _deltaPositions[i].x; - var basePos = new Vector3(i * 0.1f, 1, 0); - Gizmos.DrawLine(basePos, basePos + Vector3.up * d); - } + transform.SetPositionAndRotation(position, rotation); } } } diff --git a/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/ICameraController.cs b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/ICameraController.cs new file mode 100644 index 0000000..9d768f4 --- /dev/null +++ b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/ICameraController.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace CameraControls.Controllers +{ + public interface ICameraController + { + bool Enabled { get; } + void SetDeltaAngles(Vector2 deltaAngles); + } +} diff --git a/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/ICameraController.cs.meta b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/ICameraController.cs.meta new file mode 100644 index 0000000..a2be8fe --- /dev/null +++ b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/ICameraController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b2f20405bcbb41d4fbeceec67aa11680 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/TPSCameraController.cs b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/TPSCameraController.cs index 76eeec4..e93c1fc 100644 --- a/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/TPSCameraController.cs +++ b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Controllers/TPSCameraController.cs @@ -1,17 +1,8 @@ -using System.Collections.Generic; -using Steamworks; using UnityEngine; -#if SUPPORT_INPUTSYSTEM -using UnityEngine.InputSystem; -#endif - -#if SUPPORT_STEAMWORKS && !DISABLESTEAMWORKS -#endif - -namespace FPSCameraControls.Controllers +namespace CameraControls.Controllers { - public class TPSCameraController : MonoBehaviour + public class TPSCameraController : MonoBehaviour, ICameraController { public enum OffsetRotationType { @@ -52,53 +43,18 @@ public enum OffsetRotationType [SerializeField] private bool _lockAndHideCursor = true; -#if SUPPORT_INPUTSYSTEM - [Header("InputSystem")] - [SerializeField] - private InputActionReference _deltaActionReference = null; - - [SerializeField] - private InputActionReference _continuousActionreference = null; -#endif - -#if SUPPORT_STEAMWORKS - [Header("SteamInput")] - [SerializeField] - private string _steamCameraActionName = "Camera"; -#endif + private Vector2 _deltaAngles; + private Vector3 _lookAngles; -#if SUPPORT_STEAMWORKS && !DISABLESTEAMWORKS - private bool _steamInitialized; - private InputAnalogActionHandle_t _steamCameraActionHandle; - private InputHandle_t[] _connectedControllerInputHandles = new InputHandle_t[Constants.STEAM_INPUT_MAX_COUNT]; -#endif + public bool Enabled => enabled; - private Vector3 _lookAngles; - private List _deltaPositions = new List(); - private List _deltaTimes = new List(); + public void SetDeltaAngles(Vector2 deltaAngles) + { + _deltaAngles = deltaAngles; + } private void Start() { -#if SUPPORT_INPUTSYSTEM - _deltaActionReference?.action.Enable(); - _continuousActionreference?.action.Enable(); -#endif - -#if SUPPORT_STEAMWORKS && !DISABLESTEAMWORKS - try - { - if (!string.IsNullOrEmpty(_steamCameraActionName)) - { - _steamCameraActionHandle = SteamInput.GetAnalogActionHandle(_steamCameraActionName); - } - _steamInitialized = true; - } - catch (System.Exception e) - { - Debug.LogError($"Failed to initialize Steam Input: {e.Message}"); - } -#endif - if (_lockAndHideCursor) { Cursor.visible = false; @@ -113,69 +69,8 @@ private void LateUpdate() return; } - var deltaAngle = Vector2.zero; - - var deltaPosition = Vector2.zero; - -#if SUPPORT_INPUTSYSTEM - if (_deltaActionReference != null) - { - var v = _deltaActionReference.action.ReadValue(); - deltaPosition = v.sqrMagnitude > deltaPosition.sqrMagnitude ? v : deltaPosition; - } -#endif - -#if SUPPORT_STEAMWORKS && !DISABLESTEAMWORKS - if (_steamInitialized && _steamCameraActionHandle != null) - { - var controllerCount = SteamInput.GetConnectedControllers(_connectedControllerInputHandles); - for (int i = 0; i < controllerCount; i++) - { - var inputHandle = _connectedControllerInputHandles[i]; - var data = SteamInput.GetAnalogActionData(inputHandle, _steamCameraActionHandle); - var v = new Vector2(data.x, -data.y); - deltaPosition = v.sqrMagnitude > deltaPosition.sqrMagnitude ? v : deltaPosition; - } - } -#endif - - { - _deltaPositions.Add(deltaPosition); - _deltaTimes.Add(Time.deltaTime); - SmoothingFrameCount = Mathf.Max(1, SmoothingFrameCount); - if (_deltaPositions.Count > SmoothingFrameCount) - { - _deltaPositions.RemoveRange(0, _deltaPositions.Count - SmoothingFrameCount); - _deltaTimes.RemoveRange(0, _deltaTimes.Count - SmoothingFrameCount); - } - var totalPosition = Vector2.zero; - var totalTime = 0f; - for (int i = 0; i < _deltaPositions.Count; i++) - { - totalPosition += _deltaPositions[i]; - totalTime += _deltaTimes[i]; - } - var deltaPositionAverage = totalPosition / totalTime; - var smoothDeltaPosition = deltaPositionAverage * Time.deltaTime; - - const float DpiAverage = 96; - var dpi = Screen.dpi == 0 ? DpiAverage : Screen.dpi; - const float InchForTurn = 13; - var v = smoothDeltaPosition / dpi / InchForTurn * 180; - deltaAngle = v.sqrMagnitude > deltaAngle.sqrMagnitude ? v : deltaAngle; - } - -#if SUPPORT_INPUTSYSTEM - if (_continuousActionreference != null) - { - const float SecondsForTurn = 1.0f; - var v = _continuousActionreference.action.ReadValue() * Time.deltaTime / SecondsForTurn * 180; - deltaAngle = v.sqrMagnitude > deltaAngle.sqrMagnitude ? v : deltaAngle; - } -#endif - - _lookAngles.x = Mathf.Clamp(_lookAngles.x - deltaAngle.y * Sensitivity, -AngleMax, -AngleMin); // Look up and down - _lookAngles.y = (_lookAngles.y + deltaAngle.x * Sensitivity) % 360; // Look left and right + _lookAngles.x = Mathf.Clamp(_lookAngles.x - _deltaAngles.y * Sensitivity, -AngleMax, -AngleMin); // Look up and down + _lookAngles.y = (_lookAngles.y + _deltaAngles.x * Sensitivity) % 360; // Look left and right var rotation = Quaternion.Euler(_lookAngles); var offsetRotation = OffsetRotation == OffsetRotationType.FullRotation ? rotation : Quaternion.AngleAxis(_lookAngles.y, Vector3.up); diff --git a/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Inputs.meta b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Inputs.meta new file mode 100644 index 0000000..45660fa --- /dev/null +++ b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Inputs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 48e066460b7844d48a72c284947a750c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Inputs/CameraControls.Inputs.asmdef b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Inputs/CameraControls.Inputs.asmdef new file mode 100644 index 0000000..f5494ca --- /dev/null +++ b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Inputs/CameraControls.Inputs.asmdef @@ -0,0 +1,29 @@ +{ + "name": "CameraControls.Inputs", + "rootNamespace": "", + "references": [ + "GUID:75469ad4d38634e559750d17036d5f7c", + "GUID:68bd7fdb68ef2684e982e8a9825b18a5", + "GUID:aeee1f7ffaac59745996d0fed47daca6" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": false, + "defineConstraints": [], + "versionDefines": [ + { + "name": "com.unity.inputsystem", + "expression": "", + "define": "SUPPORT_INPUTSYSTEM" + }, + { + "name": "com.rlabrecque.steamworks.net", + "expression": "", + "define": "SUPPORT_STEAMWORKS" + } + ], + "noEngineReferences": false +} \ No newline at end of file diff --git a/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Inputs/CameraControls.Inputs.asmdef.meta b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Inputs/CameraControls.Inputs.asmdef.meta new file mode 100644 index 0000000..02ec111 --- /dev/null +++ b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Inputs/CameraControls.Inputs.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 146db588204ef4944978d48d8c59d2ba +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Inputs/CameraInput.cs b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Inputs/CameraInput.cs new file mode 100644 index 0000000..d7488f6 --- /dev/null +++ b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Inputs/CameraInput.cs @@ -0,0 +1,151 @@ +using CameraControls.Controllers; +using UnityEngine; + +#if SUPPORT_INPUTSYSTEM +using UnityEngine.InputSystem; +using System.Collections.Generic; + +#endif + +#if SUPPORT_STEAMWORKS && !DISABLESTEAMWORKS +using Steamworks; +#endif + +namespace CameraControls.Inputs +{ + public class CameraInput : MonoBehaviour + { +#if SUPPORT_INPUTSYSTEM + [Header("InputSystem")] + [SerializeField] + private InputActionReference _deltaActionReference = null; + + [SerializeField] + private InputActionReference _continuousActionreference = null; +#endif + +#if SUPPORT_STEAMWORKS + [Header("SteamInput")] + [SerializeField] + private string _steamCameraActionName = "Camera"; +#endif + +#if SUPPORT_STEAMWORKS && !DISABLESTEAMWORKS + private bool _steamInitialized; + private InputAnalogActionHandle_t _steamCameraActionHandle; + private InputHandle_t[] _connectedControllerInputHandles = new InputHandle_t[Constants.STEAM_INPUT_MAX_COUNT]; +#endif + + private ICameraController _cameraController; + private List _cameraControllerBuffer = new List(); + + private void Start() + { + _cameraController = GetComponent(); + +#if SUPPORT_INPUTSYSTEM + _deltaActionReference?.action.Enable(); + _continuousActionreference?.action.Enable(); +#endif + +#if SUPPORT_STEAMWORKS && !DISABLESTEAMWORKS + try + { + if (!string.IsNullOrEmpty(_steamCameraActionName)) + { + _steamCameraActionHandle = SteamInput.GetAnalogActionHandle(_steamCameraActionName); + } + _steamInitialized = true; + } + catch (System.Exception e) + { + Debug.LogError($"Failed to initialize Steam Input: {e.Message}"); + } +#endif + } + + private void Update() + { + if (_cameraController == null || !_cameraController.Enabled) + { + GetComponents(_cameraControllerBuffer); + foreach (var controller in _cameraControllerBuffer) + { + if (controller.Enabled) + { + _cameraController = controller; + break; + } + } + return; + } + + var deltaAngle = Vector2.zero; + + // Digital input + { + var deltaPixels = GetDeltaPixels(); + const float DpiAverage = 96; + var dpi = Screen.dpi == 0 ? DpiAverage : Screen.dpi; + const float InchForTurn = 13; + var v = deltaPixels / dpi / InchForTurn * 180; + deltaAngle = v.sqrMagnitude > deltaAngle.sqrMagnitude ? v : deltaAngle; + } + + // Analog input + { + var analogValues = GetAnalogValues(); + const float SecondsForTurn = 1.0f; + var v = analogValues * Time.deltaTime / SecondsForTurn * 180; + deltaAngle = v.sqrMagnitude > deltaAngle.sqrMagnitude ? v : deltaAngle; + } + + _cameraController.SetDeltaAngles(deltaAngle); + } + + private Vector2 GetDeltaPixels() + { + var value = Vector2.zero; + +#if SUPPORT_INPUTSYSTEM + if (_deltaActionReference != null) + { + var v = _deltaActionReference.action.ReadValue(); + value = v.sqrMagnitude > value.sqrMagnitude ? v : value; + } +#endif + +#if SUPPORT_STEAMWORKS && !DISABLESTEAMWORKS + if (_steamInitialized && _steamCameraActionHandle != null) + { + var controllerCount = SteamInput.GetConnectedControllers(_connectedControllerInputHandles); + for (int i = 0; i < controllerCount; i++) + { + var inputHandle = _connectedControllerInputHandles[i]; + var data = SteamInput.GetAnalogActionData(inputHandle, _steamCameraActionHandle); + var v = new Vector2(data.x, -data.y); + value = v.sqrMagnitude > value.sqrMagnitude ? v : value; + } + } +#endif + + return value; + } + + private Vector2 GetAnalogValues() + { + var value = Vector2.zero; + +#if SUPPORT_INPUTSYSTEM + if (_continuousActionreference != null) + { + const float SecondsForTurn = 1.0f; + var v = _continuousActionreference.action.ReadValue(); + value = v.sqrMagnitude > value.sqrMagnitude ? v : value; + } +#endif + + return value; + } + } +} diff --git a/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Inputs/CameraInput.cs.meta b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Inputs/CameraInput.cs.meta new file mode 100644 index 0000000..af1b8a4 --- /dev/null +++ b/src/ActionGameCore/Assets/CameraControls/Scripts/Runtime/Inputs/CameraInput.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: df57dca951846c8418748accb8bd0568 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/ActionGameCore/Assets/Samples/Scenes/SampleScene.unity b/src/ActionGameCore/Assets/Samples/Scenes/SampleScene.unity index ca0b574..e25af8b 100644 --- a/src/ActionGameCore/Assets/Samples/Scenes/SampleScene.unity +++ b/src/ActionGameCore/Assets/Samples/Scenes/SampleScene.unity @@ -178,7 +178,7 @@ CapsuleCollider: m_ProvidesContacts: 0 m_Enabled: 1 serializedVersion: 2 - m_Radius: 0.5 + m_Radius: 0.2 m_Height: 2 m_Direction: 1 m_Center: {x: 0, y: 1, z: 0} @@ -245,7 +245,6 @@ MonoBehaviour: m_EditorClassIdentifier: _moveActionReference: {fileID: -1680190386980627800, guid: d050cea4568e2be47bc9a4f2c136ccf9, type: 3} _jumpActionReference: {fileID: 1120369429361536294, guid: d050cea4568e2be47bc9a4f2c136ccf9, type: 3} - _steamActionSetName: InGameControls _steamMoveActionName: Move _steamJumpActionName: Jump --- !u!1 &209071631 @@ -1268,6 +1267,7 @@ GameObject: - component: {fileID: 963194228} - component: {fileID: 963194227} - component: {fileID: 963194226} + - component: {fileID: 963194231} - component: {fileID: 963194229} - component: {fileID: 963194230} m_Layer: 0 @@ -1316,7 +1316,7 @@ Camera: y: 0 width: 1 height: 1 - near clip plane: 0.3 + near clip plane: 0.1 far clip plane: 1000 field of view: 60 orthographic: 0 @@ -1363,8 +1363,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 76bea717eafe0f14188a4b53c3696b73, type: 3} m_Name: m_EditorClassIdentifier: - _deltaActionReference: {fileID: -5630151704836100654, guid: d050cea4568e2be47bc9a4f2c136ccf9, type: 3} - _continuousActionreference: {fileID: 4073854690803581126, guid: d050cea4568e2be47bc9a4f2c136ccf9, type: 3} Target: {fileID: 177208273} OffsetY: 1.5 Sensitivity: 1 @@ -1384,8 +1382,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 555f5af3ecd5c7a47862ada8aded246a, type: 3} m_Name: m_EditorClassIdentifier: - _deltaActionReference: {fileID: -5630151704836100654, guid: d050cea4568e2be47bc9a4f2c136ccf9, type: 3} - _continuousActionreference: {fileID: 4073854690803581126, guid: d050cea4568e2be47bc9a4f2c136ccf9, type: 3} Target: {fileID: 177208273} Offset: {x: 0, y: 1.5, z: 0} OffsetRotation: 1 @@ -1399,6 +1395,21 @@ MonoBehaviour: m_Bits: 4294967295 SmoothingFrameCount: 2 _lockAndHideCursor: 1 +--- !u!114 &963194231 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: df57dca951846c8418748accb8bd0568, type: 3} + m_Name: + m_EditorClassIdentifier: + _deltaActionReference: {fileID: -5630151704836100654, guid: d050cea4568e2be47bc9a4f2c136ccf9, type: 3} + _continuousActionreference: {fileID: 4073854690803581126, guid: d050cea4568e2be47bc9a4f2c136ccf9, type: 3} + _steamCameraActionName: Camera --- !u!1 &970461546 GameObject: m_ObjectHideFlags: 0 From 6c8ea985c4f31562b431c9365b857797e781c397 Mon Sep 17 00:00:00 2001 From: DAIKI Date: Fri, 28 Jun 2024 13:41:15 +0900 Subject: [PATCH 4/5] Update documents. --- src/ActionGameCore/Assets/CameraControls/CHANGELOG.md | 6 ++++++ src/ActionGameCore/Assets/CameraControls/package.json | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/ActionGameCore/Assets/CameraControls/CHANGELOG.md b/src/ActionGameCore/Assets/CameraControls/CHANGELOG.md index e301bfc..14553be 100644 --- a/src/ActionGameCore/Assets/CameraControls/CHANGELOG.md +++ b/src/ActionGameCore/Assets/CameraControls/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [1.4.0] - 2024-06-28 +### Changed +- Merged with TPS package. +- Renamed namespace to CameraControls. +- Separated script to Controller and Input. + ## [1.3.0] - 2024-06-28 ### Changed - Support SteamInput. diff --git a/src/ActionGameCore/Assets/CameraControls/package.json b/src/ActionGameCore/Assets/CameraControls/package.json index 6c20aef..a2f131d 100644 --- a/src/ActionGameCore/Assets/CameraControls/package.json +++ b/src/ActionGameCore/Assets/CameraControls/package.json @@ -1,9 +1,9 @@ { - "name": "com.eviltwo.fps-camera-controls", - "displayName": "FPS Camera Controls", - "version": "1.3.0", + "name": "com.eviltwo.camera-controls", + "displayName": "Camera Controls", + "version": "1.4.0", "unity": "2022.3", - "description": "Camera movements for FPS.", + "description": "Camera movements for FPS and TPS.", "author": { "name": "DAIKI(eviltwo)", "url": "https://github.com/eviltwo" From fe74580dba04bc5b8fa673e56f6733110565af72 Mon Sep 17 00:00:00 2001 From: DAIKI Date: Fri, 28 Jun 2024 13:53:03 +0900 Subject: [PATCH 5/5] Update README.md --- README.md | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 605c325..e6b8629 100644 --- a/README.md +++ b/README.md @@ -25,16 +25,10 @@ https://github.com/eviltwo/ActionGameCore.git?path=src/ActionGameCore/Assets/CharacterControls ``` -### FPSCameraControls v1.3.0 -FPS視点のカメラ。 +### CameraControls v1.4.0 +FPSとTPS視点のカメラ。 ``` -https://github.com/eviltwo/ActionGameCore.git?path=src/ActionGameCore/Assets/FPSCameraControls -``` - -### TPSCameraControls v1.3.0 -TPS視点のカメラ。 -``` -https://github.com/eviltwo/ActionGameCore.git?path=src/ActionGameCore/Assets/TPSCameraControls +https://github.com/eviltwo/ActionGameCore.git?path=src/ActionGameCore/Assets/CameraControls ``` ### Interactions v0.5.1