I have some code below wich instantiates a cylinder if you click on a collider using “Fire1”. And below that I have som code for the camera that lets me pan up and down, also using “Fire1”.
However while the user is paning up and down I want to dissable the collider instantition code. Becouse its annoying when you start paning over a collider and it instantiates a cyllinder when you really just wanted to pan.
Collider code:
if(Input.GetButtonDown("Fire1"))
{
var ray : Ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hit : RaycastHit;
if (collider.Raycast (ray, hit, 100.0))
{
var instanceBullet3 = Instantiate(cylinder, transform.position, Quaternion.identity);
}
}
Camera Code:
if(Input.GetButtonDown("Fire1"))//pan up and down
{
var v : float = verticalSpeed * Input.GetAxis ("Mouse Y");
transform.position += -transform.up * v;
CameraMovementBounds();
}