SHARE
TWEET

Untitled

a guest Jun 27th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.    void Update()
  2.     {
  3.         if (controller.isGrounded)
  4.         {
  5.             if(Input.GetKey(KeyCode.W))
  6.             {
  7.                 anim.SetInteger("condition", 1);
  8.                 moveDir = new Vector3(0, 0, 1);
  9.                 moveDir *=  speed;
  10.                 moveDir = transform.TransformDirection(moveDir);
  11.             }
  12.             else
  13.             {
  14.                 anim.SetInteger("condition", 0);
  15.                 moveDir = new Vector3(0, 0, 0);
  16.             }
  17.         }
  18.         rot += Input.GetAxis("Horizontal")*rotSpeed * Time.deltaTime;
  19.         transform.eulerAngles = new Vector3(0, rot, 0);
  20.  
  21.         moveDir.y -= gravity * Time.deltaTime;
  22.         controller.Move(moveDir * Time.deltaTime);
  23.     }
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top