I have a script that will cast a ray forward, but I am having trouble figuring out how to make the ray rotate around 360 degrees.
Here’s a part of the script:
public void Cast(){
Ray ray = new Ray(spawn.position,spawn.forward);
RaycastHit hit;
float lightDistance = 20;
if (Physics.Raycast(ray, out hit, lightDistance)){
lightDistance = hit.distance;
}
}
I know that you have to rotate spawn.forward, but I do not know how to do this, as a float cannot rotate a vector 3.
Any help is much appreciated!