Advertisement
Guest User

Untitled

a guest
Oct 4th, 2019
817
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.73 KB | None | 0 0
  1. void Move() {
  2. //same thing was happening when i commented out this check
  3.  if (i.horizontal != 0f && i.vertical != 0f)
  4.                 agent.isStopped = true;
  5.  
  6.             float _speed = walkSpeed;
  7.  
  8.             if (controller.isGrounded)
  9.             {
  10.                 moveDirection = new Vector3(i.horizontal, 0.0f, i.vertical);
  11.                 moveDirection *= _speed;
  12.             }
  13.  
  14.             if (!controller.isGrounded)
  15.                 moveDirection.y -= gravity * Time.deltaTime;
  16.  
  17.             controller.Move(moveDirection * Time.deltaTime);
  18. }
  19.  
  20.   public void MoveWithmouse(Vector3 pos)
  21.         {
  22.             if (controller.isGrounded)
  23.             {
  24.                 agent.SetDestination(pos);
  25.             }
  26.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement