Quantcast
Channel: Questions in topic: "addforce"
Viewing all articles
Browse latest Browse all 1264

How do change force when pressing1 key then pressing another at the same time.

$
0
0
Hey Guys i want to simulate a simple thrust like effect for example (Lunar Land). i want to thrust up when pressing up arrow key then thrust left/right when pressing the appropriate arrow key but still whilst keeping up pressed. if (Input.GetKey(KeyCode.UpArrow)) { thrust = (Vector3.up * thrustForce); } else if (Input.GetKey(KeyCode.LeftArrow)) { thrust = (Vector3.left * thrustForce); } else if (Input.GetKey(KeyCode.RightArrow)) { thrust = (Vector3.right * thrustForce); } else { thrust = (Vector3.zero); } this is what i started with, and then started to add multiple "IF" statements which still did not move right. basically below, when i press UP the object thrusts up OK, but will not move left\right until i let go of UP and press left\right again. i know this is probably a simple code issue.

Viewing all articles
Browse latest Browse all 1264

Trending Articles



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