|
@@ -120,12 +120,12 @@ public class CameraBirdSec : MonoBehaviour
|
|
|
if (Input.GetAxis("Mouse ScrollWheel") > 0)
|
|
|
{
|
|
|
//Debug.Log($"{Input.mousePosition} {Screen.width*0.5f}:{Screen.height*0.5f}");
|
|
|
- float offSetX = Screen.width * 0.5f-Input.mousePosition.x;
|
|
|
- float offSetY = Screen.height * 0.5f-Input.mousePosition.y;
|
|
|
- Vector3 moveDirection = Vector3.down * offSetY*translateSpeed + Vector3.left * offSetX*translateSpeed;
|
|
|
+ float offSetX = (Screen.width * 0.5f-Input.mousePosition.x) / Screen.width;
|
|
|
+ float offSetY = (Screen.height * 0.5f-Input.mousePosition.y) / Screen.height;
|
|
|
+ Vector3 moveDirection = Vector3.down * offSetY*translateSpeed * 110 * 9.0f / 16.0f + Vector3.left * offSetX* translateSpeed * 110;
|
|
|
// 平滑移动摄像头到目标位置
|
|
|
float cameraDistanceRange = Mathf.Clamp(currentDistance * 1.0f / maxDistance * 1.0f, 0.5f, 0.9f);
|
|
|
- target.position += moveDirection.normalized*cameraDistanceRange;
|
|
|
+ target.position += moveDirection*cameraDistanceRange;
|
|
|
//限制移动范围
|
|
|
if (fixMoveRange)
|
|
|
{
|
|
@@ -141,13 +141,13 @@ public class CameraBirdSec : MonoBehaviour
|
|
|
}
|
|
|
|
|
|
// 鼠标左键拖拽平移摄像头
|
|
|
- if (Input.GetMouseButtonDown(0) && !onUI)
|
|
|
+ if (Input.GetMouseButtonDown(1) && !onUI)
|
|
|
{
|
|
|
beginDrag?.Invoke();
|
|
|
isDragging = true;
|
|
|
lastMousePosition = Input.mousePosition;
|
|
|
}
|
|
|
- else if (Input.GetMouseButtonUp(0))
|
|
|
+ else if (Input.GetMouseButtonUp(1))
|
|
|
{
|
|
|
isDragging = false;
|
|
|
}
|