From 3dcf88a36c072e42005c48dae419c66996c96f84 Mon Sep 17 00:00:00 2001 From: SmallFox <2806143047@qq.com> Date: Thu, 21 May 2026 07:21:06 +0800 Subject: 摄像机视角实现 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 实现跟随自由旋转 --- Assets/Scripts/InputHandler.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'Assets/Scripts/InputHandler.cs') diff --git a/Assets/Scripts/InputHandler.cs b/Assets/Scripts/InputHandler.cs index ec72656..f653adb 100644 --- a/Assets/Scripts/InputHandler.cs +++ b/Assets/Scripts/InputHandler.cs @@ -14,10 +14,27 @@ namespace DS public float mouseY; private PlayerControls _inputActions; + private CameraHandler _cameraHandler; private Vector2 _movementInput; private Vector2 _cameraInput; + private void Awake() + { + _cameraHandler = CameraHandler.singleton; + } + + private void FixedUpdate() + { + float delta = Time.fixedDeltaTime; + + if (_cameraHandler != null) + { + _cameraHandler.FollowTarget(delta); + _cameraHandler.HandleCameraRotation(delta,mouseX,mouseY); + } + } + public void OnEnable() { if (_inputActions == null) @@ -48,6 +65,7 @@ namespace DS moveAmount = Mathf.Clamp01(Mathf.Abs((horizontal)) + Mathf.Abs(vertical)); mouseX = _cameraInput.x; mouseY = _cameraInput.y; + } } } -- cgit