Beginner Scripting: GetAxis

 

In this weeks Coding Task it looked at the GetAxis function. Similar to the GetKey and GetButton the GetAxis works in a similar way however a key difference is the GetKey and GetButton will return a ball and the GetAxis returns a float value between -1 and +1. These values can be accessed through the project manager. GetAxis also includes Gravity and sensitivity. It is a sliding scale between -1 and +1. The gravity of the Axis reflects in how fast the object returns to 0. Sensitivity is the opposite of gravity in this case

The script is as follows

void Update () { float h = Input.GetAxis("Horizontal"); float v = Input.GetAxis("Vertical");

Comments

Popular Posts