LineRenderer draw along Z while parent rotates.

I have a gameObject that is set to LookAt a target, and draw a LineRenderer in the opsiate direction that it is looking along it’s Z or forward. I cant get the LineRenderer to rotate with it’s parent gameObject.

Any Thoughts?

var RadarCenterID : Transform;
var Lr : LineRenderer;
var RadarMaxDist = 10.0;

function Start(){
Lr = gameObject.GetComponent(LineRenderer);
}
//
function Update(){

transform.LookAt(RadarCenterID);

posX = transform.position.x;
posY = transform.position.y;
posZ = transform.position.z;

distFromCent = (transform.position - RadarCenterID.transform.position).magnitude;
distFromEdg = (RadarMaxDist - distFromCent);

LrPos1 = transform.position;
LrPos2 = Vector3(posX,posY,posZ + distFromEdg);

//LrPos2 = transform.forward * (distFromEdg);


Lr.SetPosition(0,LrPos1);
Lr.SetPosition(1,LrPos2);

}

I see whats wrong with the code i posted.

LrPos2 = Vector3(posX,posY,posZ + distFromEdg);

it’s casting to Z but using my current X and Y pos. So it’s a horizontal line.

I need to solve for the right angle of tha triangle.

The line renderer has a Use World Space option that is enabled by default. If you turn this off, the renderer will use the object’s local space.