2 커밋 38a451fbdc ... 19b9a6759c

작성자 SHA1 메시지 날짜
  DESKTOP-5BUCSUT\LSR 19b9a6759c Merge branch 'main' of http://139.155.244.27:822/LSR/gouhuo 1 년 전
  DESKTOP-5BUCSUT\LSR a234e7e075 人物镜头避障 1 년 전

+ 19 - 5
SFGgouhuo/Assets/Bundles/Model/player1.prefab

@@ -12,6 +12,7 @@ GameObject:
   - component: {fileID: 963194227}
   - component: {fileID: 963194226}
   - component: {fileID: 963194230}
+  - component: {fileID: 3466004247539312364}
   m_Layer: 6
   m_Name: Main Camera
   m_TagString: MainCamera
@@ -26,13 +27,13 @@ Transform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 963194225}
-  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
-  m_LocalPosition: {x: 0, y: 0, z: -5}
+  m_LocalRotation: {x: 0.105389275, y: -0, z: -0, w: 0.9944311}
+  m_LocalPosition: {x: 0, y: 1.48, z: -5}
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_Children: []
   m_Father: {fileID: 9195337467653545647}
   m_RootOrder: 0
-  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+  m_LocalEulerAnglesHint: {x: 12.099, y: 0, z: 0}
 --- !u!20 &963194227
 Camera:
   m_ObjectHideFlags: 0
@@ -117,6 +118,19 @@ MonoBehaviour:
   m_RequiresDepthTexture: 0
   m_RequiresColorTexture: 0
   m_Version: 2
+--- !u!65 &3466004247539312364
+BoxCollider:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 963194225}
+  m_Material: {fileID: 0}
+  m_IsTrigger: 1
+  m_Enabled: 1
+  serializedVersion: 2
+  m_Size: {x: 1, y: 1, z: 1}
+  m_Center: {x: 0, y: 0, z: 0}
 --- !u!1 &25442114404645679
 GameObject:
   m_ObjectHideFlags: 0
@@ -3869,7 +3883,7 @@ MonoBehaviour:
   m_Name: 
   m_EditorClassIdentifier: 
   playerInput: {fileID: 5686692494084832667}
-  camera: {fileID: 0}
+  camRoot: {fileID: 0}
   jumpHeight: 4
   gravity: -9.8
   state: 0
@@ -6124,7 +6138,7 @@ MonoBehaviour:
   m_Name: 
   m_EditorClassIdentifier: 
   playerInput: {fileID: 4151364514878334464}
-  camera: {fileID: 0}
+  camRoot: {fileID: 0}
   jumpHeight: 5
   gravity: -9.8
   state: 0

+ 8 - 8
SFGgouhuo/Assets/Bundles/UI/Prefab/Dlg/DlgLogin.prefab

@@ -213,7 +213,7 @@ MonoBehaviour:
   m_OnCullStateChanged:
     m_PersistentCalls:
       m_Calls: []
-  m_text: "2\u200B"
+  m_text: "\u200B"
   m_isRightToLeft: 0
   m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
   m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
@@ -222,8 +222,8 @@ MonoBehaviour:
   m_fontMaterials: []
   m_fontColor32:
     serializedVersion: 2
-    rgba: 4281479730
-  m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
+    rgba: 4294967295
+  m_fontColor: {r: 1, g: 1, b: 1, a: 1}
   m_enableVertexGradient: 0
   m_colorMode: 3
   m_fontColorGradient:
@@ -601,7 +601,7 @@ MonoBehaviour:
   m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
   m_CustomCaretColor: 0
   m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412}
-  m_Text: 2
+  m_Text: 
   m_CaretBlinkRate: 0.85
   m_CaretWidth: 1
   m_ReadOnly: 0
@@ -1077,7 +1077,7 @@ MonoBehaviour:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 8347018673477348233}
-  m_Enabled: 0
+  m_Enabled: 1
   m_EditorHideFlags: 0
   m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
   m_Name: 
@@ -1090,7 +1090,7 @@ MonoBehaviour:
   m_OnCullStateChanged:
     m_PersistentCalls:
       m_Calls: []
-  m_text: Enter text...
+  m_text: 
   m_isRightToLeft: 0
   m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
   m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
@@ -1099,8 +1099,8 @@ MonoBehaviour:
   m_fontMaterials: []
   m_fontColor32:
     serializedVersion: 2
-    rgba: 2150773298
-  m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.5}
+    rgba: 2164260863
+  m_fontColor: {r: 1, g: 1, b: 1, a: 0.5}
   m_enableVertexGradient: 0
   m_colorMode: 3
   m_fontColorGradient:

+ 21 - 21
SFGgouhuo/Assets/GameResources/Player/PlayerArmature.prefab

@@ -152,7 +152,7 @@ Transform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 8762427900362077118}
-  m_LocalRotation: {x: 0.6008909, y: 0.052902613, z: 0.0076142256, w: 0.7975422}
+  m_LocalRotation: {x: 0.60033333, y: 0.052875843, z: 0.0077310964, w: 0.7979626}
   m_LocalPosition: {x: 0.000004911422, y: 0.3789641, z: 0.0000036811825}
   m_LocalScale: {x: 0.9999998, y: 1.0000001, z: 0.99999994}
   m_Children:
@@ -463,7 +463,7 @@ Transform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 8762427900711909222}
-  m_LocalRotation: {x: -0.003073911, y: 0.10959949, z: -0.7832786, w: 0.61192584}
+  m_LocalRotation: {x: -0.0030739438, y: 0.1095994, z: -0.7832783, w: 0.6119262}
   m_LocalPosition: {x: 0.048186224, y: 0.14500271, z: 0.00531524}
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_Children:
@@ -494,8 +494,8 @@ Transform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 8762427900721381661}
-  m_LocalRotation: {x: -0.00069370406, y: 0.09953813, z: 0.99435735, w: 0.03667751}
-  m_LocalPosition: {x: -0.068759926, y: -0.042329304, z: 0.022968927}
+  m_LocalRotation: {x: -0.0008307574, y: 0.098624244, z: 0.9944541, w: 0.036520667}
+  m_LocalPosition: {x: -0.068759926, y: -0.042310603, z: 0.022965217}
   m_LocalScale: {x: 0.99999994, y: 1, z: 1.0000001}
   m_Children:
   - {fileID: 8762427901331142558}
@@ -526,8 +526,8 @@ Transform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 8762427900724448093}
-  m_LocalRotation: {x: 0.00009642539, y: 0.09964197, z: 0.99434596, w: -0.036710378}
-  m_LocalPosition: {x: 0.06875991, y: -0.04232933, z: 0.022968912}
+  m_LocalRotation: {x: 0.00017015141, y: 0.098680675, z: 0.9944478, w: -0.036547717}
+  m_LocalPosition: {x: 0.06875991, y: -0.042310625, z: 0.02296522}
   m_LocalScale: {x: 1, y: 1.0000001, z: 1.0000001}
   m_Children:
   - {fileID: 8762427902295418897}
@@ -1014,7 +1014,7 @@ Transform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 8762427900818529073}
-  m_LocalRotation: {x: 0.6009693, y: -0.053387128, z: -0.0072786845, w: 0.79745394}
+  m_LocalRotation: {x: 0.6003844, y: -0.05341728, z: -0.007362117, w: 0.79789156}
   m_LocalPosition: {x: -0.000004854202, y: 0.37896448, z: 0.0000036954875}
   m_LocalScale: {x: 0.99999976, y: 1, z: 0.9999999}
   m_Children:
@@ -1939,7 +1939,7 @@ Transform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 8762427901331142559}
-  m_LocalRotation: {x: -0.06799531, y: -0.0011570919, z: 0.0112040695, w: 0.9976221}
+  m_LocalRotation: {x: -0.066387184, y: -0.0011570703, z: 0.010939851, w: 0.9977333}
   m_LocalPosition: {x: -0.000014133454, y: 0.28059646, z: -0.0000091815}
   m_LocalScale: {x: 0.99999994, y: 0.9999998, z: 1.0000001}
   m_Children:
@@ -3062,8 +3062,8 @@ Transform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 8762427901536452329}
-  m_LocalRotation: {x: -0.085382245, y: 0.000000008602854, z: -0.00000013025819, w: 0.9963483}
-  m_LocalPosition: {x: 0.000000021570973, y: 0.0655851, z: 0.000028437935}
+  m_LocalRotation: {x: -0.0853823, y: -0.000000020343814, z: -0.00000011514561, w: 0.9963483}
+  m_LocalPosition: {x: 0.000000016845178, y: 0.06558513, z: 0.000028406736}
   m_LocalScale: {x: 1, y: 1.0000001, z: 1.0000001}
   m_Children:
   - {fileID: 8762427900504199576}
@@ -3247,7 +3247,7 @@ Transform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 8762427901671856371}
-  m_LocalRotation: {x: 0.0054024723, y: -0.007987673, z: 0.005938837, w: 0.99993587}
+  m_LocalRotation: {x: 0.0054027783, y: -0.007987421, z: 0.0059391507, w: 0.9999359}
   m_LocalPosition: {x: -0.000016029475, y: 0.18602979, z: -0.000017094611}
   m_LocalScale: {x: 1.0000001, y: 1.0000001, z: 1.0000002}
   m_Children:
@@ -3705,7 +3705,7 @@ Transform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 8762427901885600985}
-  m_LocalRotation: {x: 0.0054268506, y: 0.007986517, z: -0.005955109, w: 0.9999356}
+  m_LocalRotation: {x: 0.005426292, y: 0.007986228, z: -0.0059554907, w: 0.9999357}
   m_LocalPosition: {x: 0.000016171934, y: 0.18602999, z: -0.000017125609}
   m_LocalScale: {x: 1.0000001, y: 0.99999994, z: 1.0000001}
   m_Children:
@@ -3976,8 +3976,8 @@ Transform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 8762427901997230135}
-  m_LocalRotation: {x: 0.06413514, y: 0.011691018, z: 0.11815656, w: 0.9908527}
-  m_LocalPosition: {x: -0.000009229407, y: 0.085700765, z: -0.0000023671892}
+  m_LocalRotation: {x: 0.06413489, y: 0.011690767, z: 0.118156016, w: 0.9908527}
+  m_LocalPosition: {x: -0.000009173527, y: 0.08570075, z: -0.0000024144538}
   m_LocalScale: {x: 0.99999994, y: 0.9999998, z: 1}
   m_Children:
   - {fileID: 8762427901671856370}
@@ -4069,8 +4069,8 @@ Transform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 8762427902022659837}
-  m_LocalRotation: {x: 0.064348854, y: -0.009912664, z: -0.11803264, w: 0.990873}
-  m_LocalPosition: {x: 0.000009343028, y: 0.08570074, z: -0.0000023946634}
+  m_LocalRotation: {x: 0.06434865, y: -0.009912908, z: -0.118032485, w: 0.99087304}
+  m_LocalPosition: {x: 0.000009411946, y: 0.08570075, z: -0.0000024221374}
   m_LocalScale: {x: 1.0000002, y: 1.0000001, z: 1.0000002}
   m_Children:
   - {fileID: 8762427901885600984}
@@ -4226,7 +4226,7 @@ Transform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 8762427902163220829}
-  m_LocalRotation: {x: -0.003074379, y: -0.109598815, z: 0.7832788, w: 0.6119258}
+  m_LocalRotation: {x: -0.0030744434, y: -0.10959875, z: 0.7832789, w: 0.61192566}
   m_LocalPosition: {x: -0.048186224, y: 0.14500263, z: 0.0053152055}
   m_LocalScale: {x: 1, y: 0.99999994, z: 0.99999994}
   m_Children:
@@ -4319,8 +4319,8 @@ Transform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 8762427902218368406}
-  m_LocalRotation: {x: 0.6983415, y: -0.000000030936622, z: -0.000000026666557, w: 0.71576476}
-  m_LocalPosition: {x: 0, y: 0.0000076293945, z: -59.36164}
+  m_LocalRotation: {x: 0.69834155, y: 2.8975575e-10, z: -0.000000017116406, w: 0.7157648}
+  m_LocalPosition: {x: 0, y: 0.0000076293945, z: -57.694782}
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_Children:
   - {fileID: 8762427901970835926}
@@ -4412,7 +4412,7 @@ Transform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 8762427902295418926}
-  m_LocalRotation: {x: -0.06820088, y: 0.0011556633, z: -0.011238603, w: 0.9976077}
+  m_LocalRotation: {x: -0.06651258, y: 0.0011558809, z: -0.01096095, w: 0.9977248}
   m_LocalPosition: {x: 0.000014123917, y: 0.28059638, z: -0.000009194316}
   m_LocalScale: {x: 1, y: 0.9999998, z: 1.0000001}
   m_Children:
@@ -4445,7 +4445,7 @@ Transform:
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
   m_GameObject: {fileID: 8762427902300486212}
-  m_LocalRotation: {x: 0.04516795, y: -2.3092636e-13, z: 0.00000014893551, w: 0.99897945}
+  m_LocalRotation: {x: 0.045167997, y: -1.6661667e-13, z: 0.0000001489354, w: 0.99897945}
   m_LocalPosition: {x: 2.025893e-15, y: 0.058465876, z: 0.011619233}
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_Children:

+ 1 - 1
SFGgouhuo/Assets/Scripts/Manager/StepManager.cs

@@ -38,7 +38,7 @@ public class StepManager : MonoBehaviour
         var characterRender = await YooAssetManager.Instance.LoadAsset<GameObject>("player1");
         player = Instantiate(characterRender);
         player.transform.position = new Vector3(24.162f, 3f, 75.317f);
-        player.transform.GetChild(0).GetComponent<MoveController>().camera = GameObject.Find("CamRoot").transform;
+        player.transform.GetChild(0).GetComponent<MoveController>().camRoot = GameObject.Find("CamRoot").transform;
         CharacterDataReMatch();
     }
 

+ 117 - 53
SFGgouhuo/Assets/Scripts/MoveController.cs

@@ -1,10 +1,11 @@
 using UnityEngine;
 using UnityEngine.EventSystems;
+using static UnityEditor.ShaderGraph.Internal.KeywordDependentCollection;
 
 public class MoveController : MonoBehaviour
 {
     public PlayerInputComponent playerInput;
-    public Transform camera;
+    public Transform camRoot;
     public float jumpHeight = 2.0f;
     public float gravity = -13.524f;
 
@@ -17,11 +18,16 @@ public class MoveController : MonoBehaviour
     private float jumpTime = 0.5f;
     private bool isGrounded = false;
     private bool hasLand = false;
+    private bool isBlock = false;
 
     private AnimatorController controller;
+    private Transform head;
+    private Transform m_camera;
     private Vector3 move;
     private Vector3 gravityMove;
     private Vector3 lastMove;
+    private Vector3 camInitPos;
+    private RaycastHit hit;
     private Vector3 colliderDir;
 
     public enum PlayerState
@@ -39,10 +45,13 @@ public class MoveController : MonoBehaviour
     {
         controller = GetComponent<AnimatorController>();
         character = GetComponent<CharacterController>();
-        playerInput = GetComponent<PlayerInputComponent>();
-        angleX = Vector3.Angle(Vector3.right, camera.right);
-        angleY = Vector3.Angle(Vector3.up, camera.up);
+        playerInput=GetComponent<PlayerInputComponent>();
+        angleX = Vector3.Angle(Vector3.right, camRoot.right);
+        angleY = Vector3.Angle(Vector3.up, camRoot.up);
         character.enabled = true;
+        head = transform.Find("Head");
+        m_camera = camRoot.transform.Find("Main Camera");
+        camInitPos = m_camera.localPosition;
     }
 
     // Update is called once per frame
@@ -54,7 +63,7 @@ public class MoveController : MonoBehaviour
     }
 
     /// <summary>
-    /// 角色移动旋转总逻辑
+    /// 锟斤拷色锟狡讹拷锟斤拷转锟斤拷锟竭硷拷
     /// </summary>
     void CharacterMovement()
     {
@@ -62,7 +71,7 @@ public class MoveController : MonoBehaviour
         {
             jumpTime += Time.deltaTime;
         }
-        // 检测是否在地面上
+        // 锟斤拷锟斤拷欠锟斤拷诘锟斤拷锟斤拷锟�
         //isGrounded = IsGrounded();
         isGrounded = IsGrounded();
         if (isGrounded && state == PlayerState.JumpDown)
@@ -74,7 +83,7 @@ public class MoveController : MonoBehaviour
         //Debug.Log(isGrounded);
         if (state == PlayerState.Ground)
         {
-            // 按下空格键触发跳跃
+            // 锟斤拷锟铰空革拷锟斤拷锟斤拷锟斤拷锟皆�
             if (playerInput.JumpInput)
             {
                 //state = PlayerState.JumpUp;
@@ -101,7 +110,7 @@ public class MoveController : MonoBehaviour
         move = Vector3.zero;
         if (state != PlayerState.Ground)
         {
-            // 应用重力
+            // 应锟斤拷锟斤拷锟斤拷
             ApplyGravity();
         }
         else
@@ -113,25 +122,26 @@ public class MoveController : MonoBehaviour
             * Time.deltaTime
             * speed;
 
-        // 移动物体
+        // 锟狡讹拷锟斤拷锟斤拷
         Move();
+        CameraLimitation();
         UpdateControlRotation();
     }
 
     void Jump()
     {
-        // 计算跳跃速度以达到指定的跳跃高度
+        // 锟斤拷锟斤拷锟斤拷跃锟劫讹拷锟皆达到指锟斤拷锟斤拷锟斤拷跃锟竭讹拷
         verticalVelocity = Mathf.Sqrt(-2.0f * gravity * jumpHeight);
     }
 
     void ApplyGravity()
     {
-        // 应用重力以模拟物体的垂直运动
+        // 应锟斤拷锟斤拷锟斤拷锟斤拷模锟斤拷锟斤拷锟斤拷拇锟街憋拷硕锟�
         verticalVelocity += gravity * Time.deltaTime;
-        // 根据垂直速度移动物体
+        // 锟斤拷锟捷达拷直锟劫讹拷锟狡讹拷锟斤拷锟斤拷
         if (verticalVelocity < 0.1f && verticalVelocity > -0.1f && state == PlayerState.JumpUp)
         {
-            //Debug.Log("*************");
+            Debug.Log("*************");
             state = PlayerState.JumpDown;
         }
 
@@ -141,10 +151,6 @@ public class MoveController : MonoBehaviour
 
     void Move()
     {
-        //Debug.Log(playerInput.name + "****" + move);
-        //var camRot = new Vector3(0, camera.eulerAngles.y, 0);
-
-
         if (playerInput.MoveInput != Vector2.zero)
         {
             Vector3 dir = Vector3.zero;
@@ -152,19 +158,19 @@ public class MoveController : MonoBehaviour
             //Debug.Log(playerInput.MoveInput);
             if (playerInput.MoveInput.x > 0)
             {
-                dir = Vector3.ProjectOnPlane(camera.right, Vector3.up);
+                dir = Vector3.ProjectOnPlane(camRoot.right, Vector3.up);
             }
             if (playerInput.MoveInput.x < 0)
             {
-                dir += Vector3.ProjectOnPlane(-camera.right, Vector3.up);
+                dir += Vector3.ProjectOnPlane(-camRoot.right, Vector3.up);
             }
             if (playerInput.MoveInput.y > 0)
             {
-                dir += Vector3.ProjectOnPlane(camera.forward, Vector3.up);
+                dir += Vector3.ProjectOnPlane(camRoot.forward, Vector3.up);
             }
             if (playerInput.MoveInput.y < 0)
             {
-                dir += Vector3.ProjectOnPlane(-camera.forward, Vector3.up);
+                dir += Vector3.ProjectOnPlane(-camRoot.forward, Vector3.up);
             }
             //Debug.Log(dir);
             Vector3 targetDir = Vector3.RotateTowards(
@@ -187,8 +193,8 @@ public class MoveController : MonoBehaviour
         //Debug.Log(move + "*******" + "************" + m);
         var angle = AngleSigned(
             Vector3.forward,
-            Vector3.ProjectOnPlane(camera.forward, Vector3.up),
-            transform.up
+            Vector3.ProjectOnPlane(camRoot.forward, Vector3.up),
+        transform.up
         );
         Quaternion rot = Quaternion.Euler(0, angle, 0);
         //Vector3 move2 = camera.transform.TransformDirection(move);
@@ -213,7 +219,7 @@ public class MoveController : MonoBehaviour
         character.Move(rm + gravityMove);
         lastMove = rm;
         controller.speed = rm.magnitude * 300;
-        camera.position = character.transform.position + new Vector3(0, 1.148f, 0);
+        camRoot.position = character.transform.position + new Vector3(0, 1.148f, 0);
     }
 
     public static float AngleSigned(Vector3 v1, Vector3 v2, Vector3 n)
@@ -229,8 +235,8 @@ public class MoveController : MonoBehaviour
 
     bool IsGrounded()
     {
-        // 在这里你可以添加检测物体是否在地面上的逻辑
-        // 例如射线检测、碰撞器检测等
+        // 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟接硷拷锟斤拷锟斤拷锟斤拷欠锟斤拷诘锟斤拷锟斤拷系锟斤拷呒锟�
+        // 锟斤拷锟斤拷锟斤拷锟竭硷拷狻�拷锟阶诧拷锟斤拷锟斤拷锟�
         var pos = transform.position;
         radius = character.radius * 0.9f;
         pointBottom = pos + transform.up * radius - transform.up * 0.1f;
@@ -259,14 +265,11 @@ public class MoveController : MonoBehaviour
             //camera.eulerAngles += (new Vector3(playerInput.touch0Input.y, playerInput.touch0Input.x, 0)) * 0.1f;
             angleX += playerInput.touch0Input.x * 10 * Time.fixedDeltaTime;
             angleY -= playerInput.touch0Input.y * 10 * Time.fixedDeltaTime;
-            angleY = angleClamp(angleY, -1, 60); //相机旋转角度限制
+            angleY = angleClamp(angleY, -45, 60);//锟斤拷锟斤拷锟阶�拷嵌锟斤拷锟斤拷锟�
+
+            //使锟矫诧拷值平锟斤拷锟斤拷转
+            camRoot.rotation = Quaternion.Lerp(camRoot.rotation, Quaternion.Euler(angleY, angleX, 0), Time.fixedDeltaTime * 100);
 
-            //使用插值平滑旋转
-            camera.rotation = Quaternion.Lerp(
-                camera.rotation,
-                Quaternion.Euler(angleY, angleX, 0),
-                Time.fixedDeltaTime * 10
-            );
         }
         if (
             playerInput.touch1Input != Vector2.zero
@@ -275,30 +278,22 @@ public class MoveController : MonoBehaviour
         {
             angleX += playerInput.touch1Input.x * 10 * Time.fixedDeltaTime;
             angleY -= playerInput.touch1Input.y * 10 * Time.fixedDeltaTime;
-            angleY = angleClamp(angleY, -1, 60); //相机旋转角度限制
+            angleY = angleClamp(angleY, -45, 60);//锟斤拷锟斤拷锟阶�拷嵌锟斤拷锟斤拷锟�
 
-            //使用插值平滑旋转
-            camera.rotation = Quaternion.Lerp(
-                camera.rotation,
-                Quaternion.Euler(angleY, angleX, 0),
-                Time.fixedDeltaTime * 10
-            );
+            //使锟矫诧拷值平锟斤拷锟斤拷转
+            camRoot.rotation = Quaternion.Lerp(camRoot.rotation, Quaternion.Euler(angleY, angleX, 0), Time.fixedDeltaTime * 100);
         }
 
         angleX += playerInput.CameraInput.x * 10 * Time.fixedDeltaTime;
         angleY -= playerInput.CameraInput.y * 10 * Time.fixedDeltaTime;
-        angleY = angleClamp(angleY, -1, 60); //相机旋转角度限制
+        angleY = angleClamp(angleY, -45, 60);//锟斤拷锟斤拷锟阶�拷嵌锟斤拷锟斤拷锟�
 
-        //使用插值平滑旋转
-        camera.rotation = Quaternion.Lerp(
-            camera.rotation,
-            Quaternion.Euler(angleY, angleX, 0),
-            Time.fixedDeltaTime * 10
-        );
+        //使锟矫诧拷值平锟斤拷锟斤拷转
+        camRoot.rotation = Quaternion.Lerp(camRoot.rotation, Quaternion.Euler(angleY, angleX, 0), Time.fixedDeltaTime * 10);
     }
 
     private static float angleClamp(float angle, float min, float max)
-    { //一个限制角度最大最小值的方法
+    { //一锟斤拷锟斤拷锟狡角讹拷锟斤拷锟斤拷锟叫≈碉拷姆锟斤拷锟�
         if (angle < -360)
             angle += 360;
         if (angle > 360)
@@ -306,9 +301,78 @@ public class MoveController : MonoBehaviour
         return Mathf.Clamp(angle, min, max);
     }
 
-    //void OnControllerColliderHit(ControllerColliderHit hit)
-    //{
-    //    Debug.Log(hit.moveDirection + "************");
-    //    colliderDir = hit.moveDirection;
-    //}
+    /// <summary>
+    /// 锟斤拷锟斤拷锟剿称撅拷头锟斤拷锟斤拷锟狡讹拷
+    /// </summary>
+    private void CameraLimitation()
+    {
+        float cosAngle = Vector3.Dot(m_camera.forward, Vector3.up);
+        float angleRad = Mathf.Asin(cosAngle);
+        float angleDeg = Mathf.Rad2Deg * angleRad;
+        float sign = Mathf.Sign(Vector3.Dot(Vector3.Cross(m_camera.forward, Vector3.up), Vector3.up));
+        float finalAngle = sign * angleDeg;
+        //float moveDistance = Mathf.Sin(Mathf.Deg2Rad * Mathf.Clamp(finalAngle, 0f, 10)) * 2;
+        float z, obsDistance=0,camDistance=0;
+        //Debug.Log(finalAngle);
+
+        //锟斤拷锟竭硷拷锟斤拷锟斤拷
+        //Ray ray = new Ray(head.position, m_camera.position - head.position);
+        //RaycastHit temphit;
+        //if (Physics.Raycast(ray, out temphit, 10f))
+        //{
+        //    if (temphit.collider.name != "Main Camera")
+        //    {
+        //        isBlock = true;
+        //        hit = temphit;
+        //        m_camera.position = Vector3.Lerp(m_camera.position, hit.point, 0.1f);
+        //    }
+        //    else
+        //    {
+        //        m_camera.localPosition = Vector3.Lerp(m_camera.localPosition, camInitPos, 0.5f);
+        //    }
+
+        //    Debug.Log(temphit.collider.name);
+
+        //}
+
+        //if (isBlock)
+        //{
+        //    ////锟斤拷锟斤拷锟斤拷转锟斤拷头锟斤拷锟斤拷
+        //    //if (finalAngle > 1)
+        //    //{
+        //    //    z = finalAngle * 0.1f;
+        //    //    camDistance = Vector3.Distance(camInitPos + new Vector3(0, 0, z),head.position);
+        //    //    Debug.DrawLine(temphit.point, head.position, Color.red);
+        //    //    Debug.DrawLine(camInitPos + new Vector3(0, 0, z), head.position, Color.blue);
+        //    //    Debug.Log(hit.collider.name+"))"+obsDistance + " // " + camDistance);
+        //    //    //if (obsDistance < camDistance && obsDistance > 0)
+        //    //    //{
+        //    //    //    m_camera.position = Vector3.Lerp(m_camera.position, hit.point, 0.1f);
+        //    //    //}
+        //    //    //else
+        //    //    //{
+        //    //    //    m_camera.localPosition = camInitPos + new Vector3(0, 0, z);
+        //    //    //}
+
+        //    //}
+        //    //else
+        //    {
+        //        m_camera.position = Vector3.Lerp(m_camera.position, hit.point, 0.5f);
+        //    }
+        //}
+        //else
+        //{
+        //锟斤拷锟斤拷锟斤拷转锟斤拷头锟斤拷锟斤拷
+        if (finalAngle > 1)
+        {
+            z = finalAngle * 0.1f;
+            m_camera.localPosition = camInitPos + new Vector3(0, 0, z);
+        }
+        else
+        {
+            m_camera.localPosition = Vector3.Lerp(m_camera.localPosition, camInitPos, 0.5f);
+        }
+        //}
+    }
+
 }

+ 1 - 1
SFGgouhuo/Assets/Scripts/UI/FaceBuild/CharacterRender.cs

@@ -79,7 +79,7 @@ public class CharacterRender : MonoBehaviour
     }
     public  async UniTask SetPlayerCloth( Good config)
     {
-        Debug.Log(config.id);
+        //Debug.Log(config.id);
         List<string> crDis = new List<string>();
         string[] numbersArray = config.mutex.Split(',');
         int[] mutex = numbersArray.Select(int.Parse).ToArray();