- Home /
Question by
chrisall76 · Jul 01, 2013 at 07:09 AM ·
c#cameramovementthird-person
Third Person Camera Help?
Hello, I'm making a 3rd person camera and I need it to be limited to the x and Y axis. A example would be the GTA camera, or the Cube World Camera. here's my script, but it does weird things like turn upsidedown and such.
using UnityEngine;
using System.Collections;
public class ThirdPersonCamera : MonoBehaviour {
public Transform Player; //What to rotate around
public float xSpeed = 125.0f; //X sensitivity
public float Limit = 45.0f;
void Update(){
transform.RotateAround(Player.position, Vector3.up, Input.GetAxis("Mouse X") * (xSpeed * Time.deltaTime) );
transform.RotateAround(Player.position, Vector3.forward, Input.GetAxis("Mouse Y") * (xSpeed * Time.deltaTime) );
}
}
Comment
hello, go on this web site you'll find a very good orbital camera script http://mentalogicus.blogspot.fr/2012/02/comment-faire-une-camera-orbitale-en.html