- Home /
Question by
omegahalom · Jul 08, 2014 at 06:00 PM ·
camerarotationarrowhorizontalkeys
Want to rotate camera horizontally around object using left and right arrow keys
I am trying to have the camera rotate around my object which is a sphere. I locked the camera onto the object using LookAt and positioning the camera in unity. I would like to be able to rotate the camera horizontally using arrow keys. Below is my script for the camera. Any suggestions?
var force : float; var jumpHeight = 8; private var isFalling = false;
function Update() { //movement var moveHorizontal : float = Input.GetAxis("Horizontal");
var moveVertical : float = Input.GetAxis ("Vertical");
var movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
rigidbody.AddForce (movement*force);
if (Input.GetKeyDown(KeyCode.UpArrow) && isFalling == false)
{
rigidbody.velocity.y = jumpHeight; //the y is y axis
}
isFalling = true;
} function OnCollisionStay ()
{
isFalling = false;
}
Comment