Odin
Explore posts from servers❔ GetAxis wont work
void Update()
{
float verticalInput = Input.GetAxis("Vertical");
float horizontalInput = Input.GetAxis("Horizontal");
//move game object as needed
Vector3 position = transform.position;
if (horizontalInput != 0)
{
position.x += horizontalInput * MoveUnitsPerSecond * Time.deltaTime;
} if (verticalInput != 0) {
position.x += verticalInput * MoveUnitsPerSecond * Time.deltaTime; } transform.position = position;
}
position.x += horizontalInput * MoveUnitsPerSecond * Time.deltaTime;
} if (verticalInput != 0) {
position.x += verticalInput * MoveUnitsPerSecond * Time.deltaTime; } transform.position = position;
}
32 replies