i need:
Move Camera in X and Z Axis with Mouse and right Mouse Button
here a script where look around.
using UnityEngine;
using System.Collections;
public class Maus : MonoBehaviour {
float deltaRotation = 50f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(Input.GetAxis("Mouse X") < 0){
//Code for action on mouse moving left
transform.Rotate (new Vector3 (0f, -deltaRotation, 0f) * Time.deltaTime);
}
else if(Input.GetAxis("Mouse X") > 0){
//Code for action on mouse moving right
transform.Rotate (new Vector3 (0f, deltaRotation, 0f) * Time.deltaTime);
}
if(Input.GetAxis("Mouse Y") < 0){
//Code for action on mouse moving left
transform.Rotate (new Vector3 (deltaRotation, 0f, 0f) * Time.deltaTime);
}
else if(Input.GetAxis("Mouse Y") > 0){
//Code for action on mouse moving right
transform.Rotate (new Vector3 (-deltaRotation, 0f, 0f) * Time.deltaTime);
}
}
}
using UnityEngine;
public class CameraPanControl : MonoBehaviour
{
// Original code sourced from LostConjugate & Matti Jokihaara via
// https://www.youtube.com/watch?v=mJCbEL5J5fg
float dragSpeed = 15f; // Found this by trial and error - applied below in Update
float scale;
float normalizedScale = 250f; // Found this by trial and error - applied below in Update
void Update()
{
Vector3 pos = transform.position;
scale = Camera.main.orthographicSize; // Use this to capture the zoom level
if (Input.GetMouseButton(2))
{
pos.x -= Input.GetAxis("Mouse X") * dragSpeed * scale / normalizedScale;
pos.z -= Input.GetAxis("Mouse Y") * dragSpeed * scale / normalizedScale;
}
transform.position = pos;
}
}