I’m having an issue with a line renderer (which will be later changed to an actual laser particle effect) where it snaps to the hit point unnaturally. I rather not have it snap at all since the goal is just to make it not go through objects and have the sphere show up at the very end of the line. Is there a fix to achieve this?
void Update () {
RaycastHit hit;
if (Physics.Raycast(transform.position, transform.forward, out hit)){
if (hit.collider){
lr.SetPosition(1, hit.point); //lr = lineRenderer
laserPoint.position = hit.point; //laserPoint is the sphere at the end of the laser
}
}
else{
lr.SetPosition(1, transform.forward*5000);
laserPoint.position = transform.forward*5000;
}
}
}