I’m trying to do a raycast that is always pointing down, relative to the object it is attached to. When the ray is touching something with the tag “Ground”, my program should type a word. When the object flips at a 90 degree angle, the ray should too, but it does not. It says pointing down in global terms. the code I’m using:
RaycastHit hit;
Ray floorRay = new Ray(transform.position, Vector3.down);
if(Physics.Raycast(floorRay, out hit, 0.2f))
{
if(hit.collider.tag == “Ground”)
{
Debug.Log (“Fart”);
}
}