Im trying to make a car move when you press a box. At the moment im using
function Update ()
{
if(Input.GetMouseButtonDown(0))
{
ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if (Physics.Raycast (ray, rayCastHit))
{
if(rayCastHit.transform.name == “Throttle”)
{
new MessageCarThrottle();
}
}
}
}
to move the car but it will only do it once per click. Is there a way to check if if(rayCastHit.transform.name == “Throttle”) is being held down?