Question by
silverxah · Jul 25, 2016 at 06:36 PM ·
rotationraycastraycasthit
[Solved]Raycast Direction Wrong
So I have a raycast starting from an empty GO which updates its own position based upon the rotation of another GO. I have the raycast direction set to the GO's forward but for some reason the the line renderer isis always at the 0,0,0 position. Any idea what might be causing this? It was working fine before but once I made the script so that the ray would stop upon colliding with an object, it stopped working. Collider script is shown below. (end is a RaycastHit obj)
if (Physics.Raycast(lazor, out end, Mathf.Infinity)){
if (end.collider.tag == "Object")
lines.SetPosition(1, lazor.GetPoint(end.distance));
Comment
Best Answer
Answer by silverxah · Jul 25, 2016 at 09:30 PM
Solved: Forgot to add the else statement so the linerenderer had an endpoint.
Your answer
![](https://koobas.hobune.stream/wayback/20220612085511im_/https://answers.unity.com/themes/thub/images/avi.jpg)