- Home /
camera movement problem?
when i turn the camera with
var tspeed:float=2.0;
function Start () {
}
function Update () { if(Input.GetButtonDown("tleft")){ transform.Rotate(0, tspeed* Time.deltaTime, 0); } if(Input.GetButtonDown("tright")){ transform.Rotate(0, -tspeed* Time.deltaTime, 0); }
}
it works when pressing the button once but when i hold it it doesnt turn any more and i have to press the button again.how to make it turn when i hold the key?
im using javascript.
Answer by aldonaletto · Aug 08, 2012 at 01:16 PM
Use Input.GetButton instead - this returns true while the button is pressed, while GetButtonDown only returns true during the frame where the button was first pressed.
Your answer
![](https://koobas.hobune.stream/wayback/20220613075350im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Error with Camera WorldtoScreenPoint 1 Answer
Holding down 'M' for map? 1 Answer
How to make camera position relative to a specific target. 1 Answer
RayCasting from camera to player 1 Answer
Camera rotation problem!! 1 Answer