Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Move() {
- //same thing was happening when i commented out this check
- if (i.horizontal != 0f && i.vertical != 0f)
- agent.isStopped = true;
- float _speed = walkSpeed;
- if (controller.isGrounded)
- {
- moveDirection = new Vector3(i.horizontal, 0.0f, i.vertical);
- moveDirection *= _speed;
- }
- if (!controller.isGrounded)
- moveDirection.y -= gravity * Time.deltaTime;
- controller.Move(moveDirection * Time.deltaTime);
- }
- public void MoveWithmouse(Vector3 pos)
- {
- if (controller.isGrounded)
- {
- agent.SetDestination(pos);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement