I want make pong tennis game and thi is supposed to be control of one platforms and 2p01 is name of colider i have this code connect with the platform. Can you help me?
Please help me with this code I have connect it to
private var ray : Ray;
private var hit : RaycastHit;
function Update () {
if(Input.GetMouseButton(0))
{
ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if(Physics.Raycast(ray, hit))
{
if (hit.collider != "2p01")
{
Move ();
}
}
}
}
function Move()
{
transform.position.x = ray.point.x;
}
}