September 2010
Beginner
384 pages
8h 49m
English
Debug.Log(Input.mousePosition.x);
function Update () {
transform.position.x = Input.mousePosition.x;
Debug.Log(Input.mousePosition.x);
}
Look at the very bottom of the screen for the results of your Debug.Log() statement. As you move the mouse cursor left and right, you'll see this number changing. It goes from 0 when your mouse is at the left edge, and rapidly increases. The upper limit depends on your monitor resolution; on my screen, Input.mousePosition.x maxes out at 1279! Earlier, a value of 2 put the paddle nearly all the way off the screen. With Debug.Log() reporting these numbers, ...
Read now
Unlock full access