|
@@ -124,7 +124,8 @@ public class CameraBirdSec : MonoBehaviour
|
|
|
float offSetY = Screen.height * 0.5f-Input.mousePosition.y;
|
|
|
Vector3 moveDirection = Vector3.down * offSetY*translateSpeed + Vector3.left * offSetX*translateSpeed;
|
|
|
// 平滑移动摄像头到目标位置
|
|
|
- target.position += moveDirection;
|
|
|
+ float cameraDistanceRange = Mathf.Clamp(currentDistance * 1.0f / maxDistance * 1.0f, 0.5f, 0.9f);
|
|
|
+ target.position += moveDirection.normalized*cameraDistanceRange;
|
|
|
//限制移动范围
|
|
|
if (fixMoveRange)
|
|
|
{
|
|
@@ -135,7 +136,7 @@ public class CameraBirdSec : MonoBehaviour
|
|
|
}
|
|
|
Vector3 targetPosition = target.position + Quaternion.Euler(new Vector3(rotateXAngle, 0, 0)) * offset.normalized * currentDistance;
|
|
|
// 摄像头平滑移动到目标位置
|
|
|
- transform.position = Vector3.Lerp(transform.position, targetPosition, Time.deltaTime * smoothSpeed * 2);
|
|
|
+ transform.position = Vector3.Lerp(transform.position, targetPosition, Time.deltaTime * smoothSpeed*2);
|
|
|
}
|
|
|
}
|
|
|
|