// Update is called once per frame
    void Update()
    {
        HandleInput();

        // velocity.y += axisY * 12 * Time.deltaTime;

        // do move

        PawnAABB.CollisionResults results = pawn.Move(velocity * Time.deltaTime);
        if (results.hitTop || results.hitBottom) velocity.y = 0;
        if (results.hitLeft || results.hitRight) velocity.x = 0;

        isGrounded = results.hitBottom;
        transform.position += results.distance;

        //one unique object to interact with
        //
    }
Example #2
0
    void Update()
    {
        HandleInput();

        // Do the move:
        PawnAABB.CollisionResults results = pawn.Move(velocity * Time.deltaTime);
        if (results.hitTop || results.hitBottom)
        {
            velocity.y = 0;
        }
        if (results.hitLeft || results.hitRight)
        {
            velocity.x = 0;
        }

        isGrounded = results.hitBottom;


        transform.position += results.distance;
    }