Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Update()
- {
- if (controller.isGrounded)
- {
- if(Input.GetKey(KeyCode.W))
- {
- anim.SetInteger("condition", 1);
- moveDir = new Vector3(0, 0, 1);
- moveDir *= speed;
- moveDir = transform.TransformDirection(moveDir);
- }
- else
- {
- anim.SetInteger("condition", 0);
- moveDir = new Vector3(0, 0, 0);
- }
- }
- rot += Input.GetAxis("Horizontal")*rotSpeed * Time.deltaTime;
- transform.eulerAngles = new Vector3(0, rot, 0);
- moveDir.y -= gravity * Time.deltaTime;
- controller.Move(moveDir * Time.deltaTime);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement