using UnityEngine; using System.Collections; public class CreateBall : MonoBehaviour { public GameObject projectile; private GameObject clone; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (Input.GetMouseButtonDown(0)) { Vector3 mousePos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 10); Vector3 putBallHere = camera.ScreenToWorldPoint(mousePos); clone = (GameObject)Instantiate(projectile, putBallHere, Quaternion.identity); clone.rigidbody.useGravity = false; /* if (Input.GetMouseButton(0)) { clone.transform.Translate(putBallHere); } */ } } }