|
@@ -11,6 +11,7 @@ public class CameraController : MonoBehaviour
|
|
|
public enum RotationAxes { Mouse, TrackMarker }
|
|
|
public RotationAxes axes = RotationAxes.Mouse;
|
|
|
public float movementSpeed = 0.1f;
|
|
|
+ public int mouseSpeed = 4;
|
|
|
public float smoothness = 0.85f;
|
|
|
|
|
|
Vector3 targetPosition;
|
|
@@ -53,14 +54,14 @@ public class CameraController : MonoBehaviour
|
|
|
if (Input.GetKey(KeyCode.W))
|
|
|
{
|
|
|
targetPosition += transform.forward * movementSpeed;
|
|
|
- Camera.main.orthographicSize += 1;
|
|
|
+ Camera.main.orthographicSize++;
|
|
|
}
|
|
|
if (Input.GetKey(KeyCode.A))
|
|
|
targetPosition -= transform.right * movementSpeed;
|
|
|
if (Input.GetKey(KeyCode.S))
|
|
|
{
|
|
|
targetPosition -= transform.forward * movementSpeed;
|
|
|
- Camera.main.orthographicSize -= 1;
|
|
|
+ if (Camera.main.orthographicSize > 1) Camera.main.orthographicSize--;
|
|
|
}
|
|
|
if (Input.GetKey(KeyCode.D))
|
|
|
targetPosition += transform.right * movementSpeed;
|
|
@@ -90,13 +91,13 @@ public class CameraController : MonoBehaviour
|
|
|
|
|
|
if (Input.GetAxis("Mouse ScrollWheel") > 0)
|
|
|
{
|
|
|
- targetPosition += transform.forward * movementSpeed;
|
|
|
- Camera.main.orthographicSize += 1;
|
|
|
+ targetPosition += transform.forward * movementSpeed* mouseSpeed;
|
|
|
+ Camera.main.orthographicSize++;
|
|
|
}
|
|
|
else if (Input.GetAxis("Mouse ScrollWheel") < 0)
|
|
|
{
|
|
|
- targetPosition -= transform.forward * movementSpeed;
|
|
|
- Camera.main.orthographicSize -= 1;
|
|
|
+ targetPosition -= transform.forward * movementSpeed*mouseSpeed;
|
|
|
+ if (Camera.main.orthographicSize > 1) Camera.main.orthographicSize -= 1;
|
|
|
}
|
|
|
|
|
|
transform.position = Vector3.Lerp(transform.position, targetPosition, (1.0f - smoothness));
|
|
@@ -107,25 +108,25 @@ public class CameraController : MonoBehaviour
|
|
|
if (Input.GetKey(KeyCode.W))
|
|
|
{
|
|
|
targetPosition += transform.forward * movementSpeed;
|
|
|
- Camera.main.orthographicSize += 1;
|
|
|
+ Camera.main.orthographicSize++;
|
|
|
}
|
|
|
if (Input.GetKey(KeyCode.S))
|
|
|
{
|
|
|
targetPosition -= transform.forward * movementSpeed;
|
|
|
- Camera.main.orthographicSize -= 1;
|
|
|
+ if (Camera.main.orthographicSize > 1) Camera.main.orthographicSize--;
|
|
|
}
|
|
|
if (Input.GetAxis("Mouse ScrollWheel") > 0)
|
|
|
{
|
|
|
- targetPosition += transform.forward * movementSpeed;
|
|
|
- Camera.main.orthographicSize += 1;
|
|
|
+ targetPosition += transform.forward * movementSpeed* mouseSpeed;
|
|
|
+ Camera.main.orthographicSize++;
|
|
|
}
|
|
|
else if (Input.GetAxis("Mouse ScrollWheel") < 0)
|
|
|
{
|
|
|
- targetPosition -= transform.forward * movementSpeed;
|
|
|
- Camera.main.orthographicSize -= 1;
|
|
|
+ targetPosition -= transform.forward * movementSpeed* mouseSpeed;
|
|
|
+ if(Camera.main.orthographicSize > 1) Camera.main.orthographicSize--;
|
|
|
}
|
|
|
- var marker_offset = new Vector3(5, 0, 5);
|
|
|
- transform.position = Vector3.Lerp(transform.position, targetPosition + target.position - marker_offset, (1.0f - smoothness));
|
|
|
+ var marker_offset = new Vector3(target.position.x, targetPosition.y, target.position.z);
|
|
|
+ transform.position = Vector3.Lerp(transform.position, /*targetPosition + target.position - */marker_offset, (1.0f - smoothness));
|
|
|
if (Input.GetMouseButton(1)) axes = RotationAxes.Mouse;
|
|
|
}
|
|
|
}
|