Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void Move()
- {
- if (joystick.Vertical != 0 && joystick.Horizontal != 0)
- {
- Debug.Log("Move");
- transform.rotation = Quaternion.RotateTowards(transform.rotation,
- Quaternion.LookRotation(new Vector3(joystick.Horizontal, 0f, joystick.Vertical)),
- rotationSpeed * Time.deltaTime);
- rb.velocity = new Vector3(joystick.Horizontal * movementSpeed, rb.velocity.y,
- joystick.Vertical * movementSpeed);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement