I’m creating a game where I want to pull the ball and then release it, so it can fly towards the wall.
Kind of an effect like you can see in angry birds.
Here is a little bit of code:
What I want is that you really see that pulling effect from the original position, now I’m just grabbing it.
private bool release = false;
private bool hold = false;
private int pulledAmount = 0;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnMouseDown(){
Debug.Log ("Klik");
}
void OnMouseDrag(){
pulledAmount += 1;
Vector3 pz = Camera.main.ScreenToWorldPoint(Input.mousePosition);
pz.z = 0;
GameObject.Find("Ball").transform.position = pz;
}
void OnMouseUp(){
Debug.Log("Drag ended!");
}