Hi All,
I’m currently trying to create a pool game. I’ve got the line renderer working so that whatever direction the player aims their ball in, a targeting line goes out and stops when it collides with any surface. I’m struggling to add a deflection line to show what direction the ball being hit will go though. I’ve searched all over and all forums are referring specifically to Unity3D and trying to adapt those to 2D just hasn’t worked for me! Here’s what I’ve got so far for the main line. Thanks!
RaycastHit2D hit = Physics2D.Raycast(transform.position, transform.up);
hitPoint.position = hit.point;
Debug.DrawLine(transform.position, hitPoint.position);
lineRenderer.SetPosition(0, transform.position);
lineRenderer.SetPosition(1, hitPoint.position);