private var ray : Ray;
private var rayCastHit : RaycastHit;
function Update() {
if(Input.GetMouseButton(0)) {
ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray.rayCastHit)) {
transform.position.x = rayCastHit.point.x;
}
}
}
by the way i got this code from youtube tutorial making a ping pong game. But i have this error at line 10 and 11. please help why is this wrong but in his tutorial this is correct