Quantcast
Channel: Latest Questions by MobiusDev
Viewing all articles
Browse latest Browse all 22

My first Script in unity...

$
0
0
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 are probably 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 all articles
Browse latest Browse all 22

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>