Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity 2d joystick controls

public Joystick joystick;

private Vector3 input;
public float Speed = 5f;

private void Update()
    {
        input = new Vector3(joystick.Horizontal, joystick.Vertical);
        Vector3 velocity = input.normalized * Speed;
        transform.position += velocity * Time.deltaTime;
    }
 
PREVIOUS NEXT
Tagged: #unity #joystick #controls
ADD COMMENT
Topic
Name
5+7 =