Example #1
0
    void Update()
    {
        moveTo = Vector3.zero;

        // Based on swipe, manipulate transform vector
        if (swipe.GetUp())
        {
            moveTo += new Vector3(0, 0, 20);
        }
        if (swipe.GetDown())
        {
            moveTo += new Vector3(0, 0, -20);
        }
        if (swipe.GetLeft())
        {
            moveTo += new Vector3(20, 0, 0);
        }
        if (swipe.GetRight())
        {
            moveTo += new Vector3(-20, 0, 0);
        }

        // Move box towards the new transform vector in 1 second (1 * fps)
        box.position = Vector3.MoveTowards(box.position, box.position + 5 * moveTo, 20 * Time.deltaTime);
    }
    void Update()
    {
        // TODO: fix directions
        if (obj.GetComponentInChildren <SkinnedMeshRenderer>().isVisible)
        {
            string item = ARHandler.GetHitIfAny();

            moveTo = Vector3.zero;

            // Based on swipe, manipulate transform vector
            if (swipe.GetUp())
            {
                moveTo += new Vector3(0, 0, 0.001f);
            }
            if (swipe.GetDown())
            {
                moveTo += new Vector3(0, 0, -0.001f);
            }
            if (swipe.GetLeft())
            {
                moveTo += new Vector3(0.001f, 0, 0);
            }
            if (swipe.GetRight())
            {
                moveTo += new Vector3(-0.001f, 0, 0);
            }

            //moveTo = new Vector3(-0.001f, 0, 0);

            if ((planks[which].transform.position - hint.transform.position).magnitude < 0.3f)
            {
                planks[which].transform.position = Vector3.MoveTowards(planks[which].transform.position, planks[which].transform.position + 5 * moveTo, 20 * Time.deltaTime);
            }
            else
            {
                if (which < 4)
                {
                    which++;
                }
            }

            if (ARHandler.GetHitIfAny().Equals(hintsphere.name))
            {
                Destroy(hint);
                Destroy(hintsphere);
                ARHandler.GetAchievement("Yak whisperer");
            }
        }
    }