I'm learning 3D game development with some kind of mini golf game.
It is working well so far: I have a sphere, and I am using
AddForce on its
RigidBody to launch it in the desired direction.
One feature I'd like to add is to show a preview line that predicts the trajectory of the ball. Like telling the player that if he uses this direction and this force, the ball is going to follow this route, collide here, bounce, and end up there etc.
I know how to use a line renderer alright, but I don't know how to calculate the array of points from which to draw the line.
It has to be updated in realtime, and the player can quickly change the potential direction and force at any time - it has to consider that there are various objects with different bounciness/friction etc.
That seems like a lot of work. The only thing that occurs to me is to use dummy invisible balls that will be constantly firing using the potential direction/force and then recording their route, but I'd need to figure out some way to make them 'move faster' so I can get the array of points instantly.
What would be my best approach for this?