摄像头bug
This commit is contained in:
parent
6814e21b64
commit
8c2282dc95
47883
xiaofang/Assets/Scenes/Tmap 1 (2).unity
Normal file
47883
xiaofang/Assets/Scenes/Tmap 1 (2).unity
Normal file
File diff suppressed because it is too large
Load Diff
7
xiaofang/Assets/Scenes/Tmap 1 (2).unity.meta
Normal file
7
xiaofang/Assets/Scenes/Tmap 1 (2).unity.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 76c2c25012ced4e4eb0074040b297901
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -6896,6 +6896,52 @@ PrefabInstance:
|
||||
objectReference: {fileID: 7400000, guid: 7012e3de65d9c6745a7751b1ca0b63aa, type: 2}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 6025bf38a7ada134281ba43ad08c154b, type: 3}
|
||||
--- !u!1 &222376206
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 222376208}
|
||||
- component: {fileID: 222376207}
|
||||
m_Layer: 0
|
||||
m_Name: BurstCollisionWorld
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &222376207
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 222376206}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f1a161c4294214a4fbcb7e9e94800494, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
cellSpans:
|
||||
m_AlignBytes: 16
|
||||
--- !u!4 &222376208
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 222376206}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 38
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!64 &224425900
|
||||
MeshCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -15172,52 +15218,6 @@ MeshCollider:
|
||||
m_Convex: 0
|
||||
m_CookingOptions: 30
|
||||
m_Mesh: {fileID: -4065182513467256702, guid: 00003e04dc9a2534eb207f108c7b0cd3, type: 3}
|
||||
--- !u!1 &908900261
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 908900263}
|
||||
- component: {fileID: 908900262}
|
||||
m_Layer: 0
|
||||
m_Name: BurstCollisionWorld
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &908900262
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 908900261}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f1a161c4294214a4fbcb7e9e94800494, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
cellSpans:
|
||||
m_AlignBytes: 16
|
||||
--- !u!4 &908900263
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 908900261}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 38
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &909474842
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -28371,7 +28371,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
m_IsActive: 1
|
||||
--- !u!81 &1707678917
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -2,6 +2,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using static UnityEngine.GraphicsBuffer;
|
||||
|
||||
public class PlayerMovement_Jpystick : MonoBehaviour, IDragHandler
|
||||
{
|
||||
@ -135,13 +136,27 @@ public class PlayerMovement_Jpystick : MonoBehaviour, IDragHandler
|
||||
}
|
||||
public void HandleViewSwipe()
|
||||
{
|
||||
cameraControl.CamerMove();
|
||||
// // 滑动视角逻辑
|
||||
// float horizontalSwipe = touch.deltaPosition.x * 0.1f; // 可调整灵敏度
|
||||
// float verticalSwipe = -touch.deltaPosition.y * 0.1f;
|
||||
if (Mathf.Abs(mainCamera.transform.eulerAngles.x - transform.eulerAngles.x) < 315 && Mathf.Abs(mainCamera.transform.eulerAngles.x - transform.eulerAngles.x) > 45)
|
||||
{
|
||||
|
||||
}
|
||||
if (Mathf.Abs(mainCamera.transform.eulerAngles.y - transform.eulerAngles.y) < 315 && Mathf.Abs(mainCamera.transform.eulerAngles.y - transform.eulerAngles.y) > 45)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// cameraTransform.Rotate(0, horizontalSwipe, 0, Space.World);
|
||||
// cameraTransform.Rotate(verticalSwipe, 0, 0, Space.Self);
|
||||
else
|
||||
{
|
||||
cameraControl.CamerMove();
|
||||
}
|
||||
|
||||
|
||||
// // 滑动视角逻辑
|
||||
// float horizontalSwipe = touch.deltaPosition.x * 0.1f; // 可调整灵敏度
|
||||
// float verticalSwipe = -touch.deltaPosition.y * 0.1f;
|
||||
|
||||
// cameraTransform.Rotate(0, horizontalSwipe, 0, Space.World);
|
||||
// cameraTransform.Rotate(verticalSwipe, 0, 0, Space.Self);
|
||||
}
|
||||
|
||||
public void MoveState()
|
||||
|
@ -47,13 +47,16 @@ public class JoystickController : MonoBehaviour, IDragHandler, IEndDragHandler
|
||||
// 根据摇杆的输入控制摄像机旋转
|
||||
targetXRotation = joystickInput.x * rotationSpeed * Time.deltaTime;
|
||||
targetYRotation = joystickInput.y * rotationSpeed * Time.deltaTime;
|
||||
|
||||
float angleDifference = Mathf.Abs(playerCamera.transform.eulerAngles.x - target.transform.eulerAngles.x);
|
||||
float angleDifference2 = Mathf.Abs(playerCamera.transform.eulerAngles.y - target.transform.eulerAngles.y);
|
||||
Debug.Log(angleDifference);
|
||||
Debug.Log(angleDifference2);
|
||||
// if (playerCamera.transform.eulerAngles.x<-30) return;
|
||||
if (playerCamera.transform.eulerAngles.x <330&& playerCamera.transform.eulerAngles.x > 30)
|
||||
if (Mathf.Abs(playerCamera.transform.eulerAngles.x-target.transform.eulerAngles.x) <330&& Mathf.Abs(playerCamera.transform.eulerAngles.x - target.transform.eulerAngles.x) > 30)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (playerCamera.transform.eulerAngles.y < 315 && playerCamera.transform.eulerAngles.y > 45)
|
||||
if (Mathf.Abs(playerCamera.transform.eulerAngles.y - target.transform.eulerAngles.y) < 315 && Mathf.Abs(playerCamera.transform.eulerAngles.y - target.transform.eulerAngles.y) > 45)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user