As in, move the camera once the cursor reaches the screen edge?
It's not a behaviour provided by any of AC's built-in cameras, but it's fairly simple to incorporate custom camera scripts into AC.
See the Manual's "Custom cameras" chapter. If you had a script that handled camera movement in the way you wanted, you could then attach the Basic Camera component to it to have it show up in AC Camera fields - e.g. "Default Camera" in the Scene Manager.
Here's a super-basic example script:
using UnityEngine;
using AC;
public class CameraMousePan : MonoBehaviour
{
public float edgeThreshold = 0.1f;
public float moveSpeed = 5f;
private Vector3 forwardDirection;
private Vector3 rightDirection;
private void Awake ()
{
forwardDirection = new Vector3 (transform.forward.x, 0f, transform.forward.z);
rightDirection = new Vector3 (transform.right.x, 0f, transform.right.z);
}
private void Update ()
{
if (!KickStarter.stateHandler.IsInGameplay ())
{
return;
}
Vector2 relativeMousePosition = new Vector2 (Input.mousePosition.x / Screen.width, Input.mousePosition.y / Screen.height);
if (relativeMousePosition.x < edgeThreshold)
{
// Move left
transform.position -= rightDirection * moveSpeed * Time.deltaTime;
}
else if (relativeMousePosition.x > (1f - edgeThreshold))
{
// Move right
transform.position += rightDirection * moveSpeed * Time.deltaTime;
}
if (relativeMousePosition.y < edgeThreshold)
{
// Move up
transform.position -= forwardDirection * moveSpeed * Time.deltaTime;
}
else if (relativeMousePosition.y > (1f - edgeThreshold))
{
// Move down
transform.position += forwardDirection * moveSpeed * Time.deltaTime;
}
}
}
Comments
As in, move the camera once the cursor reaches the screen edge?
It's not a behaviour provided by any of AC's built-in cameras, but it's fairly simple to incorporate custom camera scripts into AC.
See the Manual's "Custom cameras" chapter. If you had a script that handled camera movement in the way you wanted, you could then attach the Basic Camera component to it to have it show up in AC Camera fields - e.g. "Default Camera" in the Scene Manager.
Here's a super-basic example script:
thanks! I will try it