Raycasting, How to draw a line to the position of the rays end when nothing is hit

So the problem I’ve got is that I need to be able to draw a Line using line renderer to the end of the raycast when nothing is hit. Here is a code sample that might help showing what I’m looking for:

Vector3 fwd = AttackPos.transform.forward;

			if(Physics.Raycast(AttackPos.transform.position, fwd, out hit, shotDistance)){
				if(hit.transform.tag == "Other"){
					hit.transform.GetComponent<HealthManager>().TookDamage(bulletDamage, hit.point);
					if(hit.transform.gameObject.layer == 9){
						_netMan.ShotPlayer(hit.transform.GetComponent<Interpolation>().gottenIndex, bulletDamage, hit.point);
					}
					else{
						if(hit.transform.GetComponent<Interpolation>() != null){
							_netMan.ShotAI(hit.transform.GetComponent<Interpolation>().gottenIndex, bulletDamage, hit.point);
						}
						else{
							_netMan.ShotAI(_netMan.playerINDEX, bulletDamage, hit.point);
						}
					}
					
				}
				if(hasLaserBeam){

					DrawLine(linePos.transform.position, hit.point);
				}
			}
			else{
				if(hasLaserBeam){
					DrawLine(linePos.transform.position, fwd*shotDistance);
				}
			}

All the code inside the if(hit) statement works, it is tThe else statement ( when nothing is hit) that is the problem. It keeps drawing a line towards the origo of the scene instead of to the position fwd*shotDistance. The attackposition is a child object so can this problem be related to transformpoint/transformdirection since the coordinates aren’t in worldspace?

The problem is that your DrawLine() takes two positions (assumed from the first call to DrawLine()). On line 26, you are passing it a position and a direction. The line should be:

DrawLine(linePos.transform.position, AttackPos.transform.position+fwd*shotDistance);