var rotationSpeed = 50.0;
function Update()
{
var hit : RaycastHit;
var ray : Ray = Camera.mainCamera.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2, 0));
if (Physics.Raycast (ray, hit, 100.0) && hit.collider.gameObject.tag == "Container")
{
if (Input.GetKey (KeyCode.LeftArrow))
{
var ydir = Input.GetAxis("Horizontal");
transform.Rotate(0,ydir * rotationSpeed * Time.deltaTime,0);
}
if (Input.GetKey (KeyCode.RightArrow))
{
var ydir1 = Input.GetAxis("Horizontal");
transform.Rotate( 0,ydir1 * rotationSpeed * Time.deltaTime ,0);
}
if (Input.GetKey (KeyCode.UpArrow))
{
var ydir2 = Input.GetAxis("Vertical");
transform.Rotate( ydir2 * rotationSpeed * Time.deltaTime,0,0);
}
if (Input.GetKey (KeyCode.DownArrow))
{
var ydir3 = Input.GetAxis("Vertical");
transform.Rotate( ydir3 * rotationSpeed * Time.deltaTime,0,0);
}
}
}