Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Start()
- {
- fixedJoystick = GameObject.Find("Joystick").GetComponent<FixedJoystick>();
- }
- public void Update()
- {
- mov = new Vector3(SimpleInput.GetAxis("Horizontal") * speed, 0, SimpleInput.GetAxis("Vertical") * speed);
- playerController.Move(mov * speed * Time.deltaTime);
- if (Vector3.Angle(Vector3.forward, mov) > 1f || Vector3.Angle(Vector3.forward, mov) == 0)
- {
- Vector3 direct = Vector3.RotateTowards(transform.forward, mov, speed, 0.0f);
- transform.rotation = Quaternion.LookRotation(direct);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment