Advertisement
walkerkg

move

Feb 16th, 2019
443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.43 KB | None | 0 0
  1.     private void Move()
  2.     {
  3.         if (joystick.Vertical != 0 && joystick.Horizontal != 0)
  4.         {
  5.             Debug.Log("Move");
  6.             transform.rotation = Quaternion.RotateTowards(transform.rotation,
  7.                 Quaternion.LookRotation(new Vector3(joystick.Horizontal, 0f, joystick.Vertical)),
  8.                 rotationSpeed * Time.deltaTime);
  9.  
  10.             rb.velocity = new Vector3(joystick.Horizontal * movementSpeed, rb.velocity.y,
  11.                 joystick.Vertical * movementSpeed);
  12.         }
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement