How can I tap an object to Wake up its rigidbody on an Android device?

I’m making a puzzle-type game where the player taps a sphere at the right time to make it roll through a course or something. I’ve looked around and learned using Raycast might work, but I’m not really confident in my scripting. This is the script I have:

var ray : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);

var hit : RaycastHit;

function Start () {

rigidbody.Sleep();

}

function Update () {

if (Physics.Raycast(ray, hit, 100)) {

	rigidbody.WakeUp();
	
}

}

But, when I test it on my android device, I try to tap on the ball and nothing happens. Is there an error in my code, or am I completely taking the wrong approach to this?

It doesn’t work because there is no mouse or cursor on the Android. You need to use Input.touches.

You’ll need to use Input.touches[0].position for a touch. Or you can check input.touchCount and see if there are touches and then use input.gettouch(0).position and change the index for the order of the finger touching. Anyway you’ll need to use .position to get the Vector you want to work with.