Paddle Problem

So when i move my mouse the platform moves with it, but the platform is not in the same position as my mouse, they have 2 different positions but move as my mouse moves!

Edited

public class Ball : MonoBehaviour {
public Paddle paddle;
private Vector3 paddletoballVector;
private bool hasstarted;
// Use this for initialization
void Start () {
paddletoballVector = this.transform.position - paddle.transform.position;

}

// Update is called once per frame
void Update () {
	if (!hasstarted) {
	this.transform.position = paddle.transform.position + paddletoballVector;
	if (Input.GetMouseButtonDown(0)) {
		print ("Mouse Clicked");
		hasstarted = true;
		this.rigidbody2D.velocity = new Vector2 (2f,10f);
	}
	
	}
}

}

Privacy & Terms