Android touch movement not responding

I have this code attached to a cube but it won't do a darn thing and I can't figure out why! The GUI Box triggers so I know the code works but the box just won't move. I've traced the touch count and phase and all is as it should be but my box won't budge an inch. Can anyone explain?

float speed;



bool touchDetect = false;



// Use this for initialization

void Start ()

{

    speed = 10.0f;

}



// Update is called once per frame

void Update()

{

    if (Input.touchCount > 0)

    {

        if (Input.GetTouch(0).phase == TouchPhase.Stationary)

        {



            rigidbody.AddForce(Vector3.forward * speed * Time.deltaTime;);



            touchDetect = true;



        }

    }



    else

    {

        touchDetect = false;

    }

}



void OnGUI()

{

    if (touchDetect)

    {

        GUI.Box(new Rect(100, 100, 100, 100), "Touch");

    }

}

Answers


Because it's a cube, no I'm not joking. Your force is not enough to push a cube. Try to set your speed = 1000; or using a sphere not cube, you will see what you want.


Need Your Help

How to deserialize an uploaded font from a Base64String?

c# html5 filereader

I need to get the font family name from an uploaded font. The user uploads a .ttf file. When I try to deserialize the data I get the following error "The input stream is not a valid binary format...

Receiving return None value

python python-3.x

I am doing exercise from the book where I am supposed to write program that can take a positive integer greater than 2 and write out the number of times one must repeatedly divide this number by 2 ...