how to make character face direction of movement unity code example
Example: how to make an object face the movement direction in unity
float moveHorizontal = Input.GetAxisRaw ("Horizontal"); float moveVertical = Input.GetAxisRaw ("Vertical"); Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical); transform.rotation = Quaternion.LookRotation(movement); transform.Translate (movement * movementSpeed * Time.deltaTime, Space.World);