Hey all,
I’m trying to make a RayCast from the centre of my camera, but it’s not working properly- it only works if I’m facing a certain direction. My code so far is:
void FixedUpdate() {
RaycastHit hit;
Ray forwardRay = new Ray (player.transform.position, Vector3.forward);
if (Physics.Raycast (forwardRay, out hit, sightDistance)) {
//more code
}
What’s going wrong? Thanks so much!
-SM