So if you are using a new version of unity probably above 2018, you can use the nice method
Physics.Simulate(dt); // delta time, dt, is the amount of time to simulate.
- https://docs.unity3d.com/ScriptReference/Physics.Simulate.html
- https://docs.unity3d.com/2018.3/Documentation/ScriptReference/PhysicsScene.Simulate.html
By using this function you can manually advance the simulation. This method should be applied to a different physics scene. Therefore I suggest that when you click you will simulate a few physics steps (the more you will simulate the more accurate indication the player will get), with every step you store the position of the object and when you are done simulating draw a line between all the points. In my opinion, it should run quite fast if done correctly.
The code should look something like this:
public PhysicsScene physicsScene;
GameObject actualBall;
GameObject simulatedBall;
OnClick() {
simulatedBall.SetPosition(actualBall.transform.position);
if (!physicsScene.IsValid())
return; // do nothing if the physics Scene is not valid.
for (int i=0; i < 10; i++) {
physicsScene.Simulate(Time.fixedDeltaTime);
// store the position.
myPoints.append(simulatedBall.rb.position);
}
// draw a line from the stored points.
}
In addition there is this video that I hope will help, good luck https://www.youtube.com/watch?v=GLu1T5Y2SSc
I hope I answered your question and if not tell me :)