I resolved the question on how to draw a line, so here is the result:
https://www.dropbox.com/s/hvc9yr3jjbqdv7r/dc.jpg?dl=0
So, now I want to create a line that shows the possible bounce off the wall (and the other ball).
Some suggested I use the Reflect method but it did not work, here is how I implemented it, script is attached to the white que ball:
//
Ray ray2 = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit2;
//
if (Physics.Raycast(ray2, out hit2, 100.0f)){
//position of white wall
Vector3 startPos = transform.position;
//cliked position, translated to the table plane
Vector3 clickPos2 = new Vector3(hit2.point.x, hit2.point.y, transform.position.z);
//get direction from ball to clicked position
Vector3 direction = Direction (clickPos2 - startPos);
//so I simply should do I reflect, it gives me a bit odd results
Vector3 reflectDir = Vector3.Reflect(direction, hit2.normal);
//finally im drawing the line
lineRenderer.SetPosition(0, startPos);
Vector3 forward = transform.TransformDirection(direction) * 100;
lineRenderer.SetPosition(1, forward);
//reflection?
lineRenderer.SetPosition(2, hit2.point);
lineRenderer.SetPosition(3, reflectDir);
Here is what this code gives me:
https://www.dropbox.com/s/9dfb3vyqmbknzes/gb.jpg?dl=0
Any ideas on how to make it work?
Mirza