I am attempting to make a pong clone and I am currently working on a script that will keep the ball anchored to the players paddle before the game starts. I have the ball moving with the paddle, except it seems to be a frame behind, almost like it is interpolating the movement over time. How can I make it feel like the ball is more anchored to the paddle? Is this an issue with the order in which the scripts execute?
Here is my GameController class
public class GameController : MonoBehaviour
{
public GameObject paddle1;
public GameObject ballPrefab;
private Transform ballTrans;
private bool playing;
private void Start()
{
playing = false;
ballTrans = Instantiate(ballPrefab).transform;
}
private void Update()
{
if (!playing)
{
ballTrans.position = paddle1.transform.position + new Vector3(0.4f, 0, 0);
}
}
}