Im trying to draw lines that predict the movement after the colliosn of 2 balls in a pool game.
How do I do that?
I heard it can be done via Raycasts, but how do I draw a line?
Any tutorials, tips?
Mirza
Im trying to draw lines that predict the movement after the colliosn of 2 balls in a pool game.
How do I do that?
I heard it can be done via Raycasts, but how do I draw a line?
Any tutorials, tips?
Mirza
to what detail are you expecting the prediction?
If it’s just basic linear motion. Reflect the vector over the normal of the edge that is being hit.
Vector3.Reflect:
Vector2.Reflect:
If you need more detail, such as friction, and spin, and what not… there’s a bit more work to be done.
You can use a raycast determine the edge that will be hit, which also returns the normal of that edge.
As for drawing the lines. There’s all sorts of options. You could use LineRenderer for instance: