Quantcast
Channel: Answers by "Peter G"
Viewing all articles
Browse latest Browse all 90

Answer by Peter G

$
0
0
It's because whoever wrote the code is writing it into a Vector3. The `?:` (It's called the conditional/ternary operator) is setting the x value of the Vector3. Then the y component is 0, and the z is the other axis. It would probably make more sense written like this: moveDirection = new Vector3( Input.GetMouseButton(1) ? Input.GetAxis("Horizontal") : 0 //x ,0 //y ,Input.GetAxis("Vertical") ); //z There was also an extra set of `()`'s.

Viewing all articles
Browse latest Browse all 90

Trending Articles