Quantcast
Viewing latest article 2
Browse Latest Browse All 22

My first Script in unity...

For my first script in unity i tired to make a very simple flying game.(Yes i know it is missing pitch and roll) The first major issue is that when i try to yaw left it only increments by one degree every time i press the button, despite me having the yaw var at 5. Also how would i script it so you can just hold the button down? (with loops?) The proboly are a million other things wrong with my script but oh well... thanks in advance. var speedInput = 0; var yaw = 10f; function Start () { } function Update () { if(Input.GetButtonDown("SpeedUp")){ speedInput++; } if(Input.GetButtonDown("SpeedDown")){ speedInput--; } transform.Translate(Vector3.forward * speedInput * Time.deltaTime); Debug.Log(speedInput * Time.deltaTime); //This paragraph is for speed if(Input.GetButtonDown("YawLeft")){ transform.Rotate(Vector3(0, -yaw * Time.deltaTime, 0)); } if(Input.GetButtonDown("YawRight")){ transform.Rotate(Vector3(0, yaw * Time.deltaTime, 0)); //this "paragraph is for yaw" } }

Viewing latest article 2
Browse Latest Browse All 22

Trending Articles