Esempio n. 1
0
    void FixedUpdate()
    {
        Vector2 current_position = GetComponent <Rigidbody2D>().position;

        input = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
        input = Vector2.ClampMagnitude(input, 1);

        if (!frozen)
        {
            Vector2 moveto = current_position + input * speed * Time.deltaTime;
            isoRend.SetDirection(input * speed);
            GetComponent <Rigidbody2D>().MovePosition(moveto);
        }
        else
        {
            isoRend.SetDirection(input * 0.0001f);
        }
    }
Esempio n. 2
0
    void FixedUpdate()
    {
        Vector2 curPos = GetComponent <Rigidbody2D>().position;
        Vector2 input  = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));

        input = Vector2.ClampMagnitude(input, 1);

        Vector2 moveTo = curPos + (input * speed * Time.deltaTime);

        isoRend.SetDirection(input * speed);
        GetComponent <Rigidbody2D>().MovePosition(moveTo);
    }