- Home /
Question by
Anthony-Adam · Apr 28, 2017 at 05:51 AM ·
unity 5raycastinglinerenderer
Line Renderer End Point not getting updated when parent object is rotated
Hey Guys, I have a line renderer as a child object of another gameobject in the scene. What i am doing is trying to raycast from the parent gameobject and update the Line Renderer's End point as the position the Raycast falls on? I am able to set the position but the issue i am currently facing is that if rotate the Parent gameobject, the line renderer does not rotate along with it. The only result is that the line renderer snaps on to the object it is raycasted upon. the code i wrote is below:
if (taskStatus == TaskStatus.Start){
targetPointer.SetPosition(0, handGameObject.transform.position);
if (Physics.Raycast(handGameObject.transform.position, handGameObject.transform.forward, out hit)) {
targetPointer.SetPosition(1, hit.transform.position);
}
}
Comment
Your answer
