Raycasts not rotating correctly

I have raycasts that starts from the surface and try to detect wheter there is an obstacle. I draw them using Debug.DrawRay()

                    Debug.DrawRay(raycastOriginPoint, Quaternion.Euler(45, 0, 0) * this.transform.right * surfaceRadius, Color.blue);
                    Debug.DrawRay(raycastOriginPoint, Quaternion.Euler(-45, 0, 0) * this.transform.right * surfaceRadius, Color.blue);
                    Debug.DrawRay(raycastOriginPoint, Quaternion.Euler(0, 0, 0) * this.transform.right * surfaceRadius, Color.blue);

But when the player turns, the raycasts rotate differently, this is what I get raycast - YouTube . I tried with transform.forward but it’s the same thing. transform.up gives me the same result as Vector3.up wich is not binded to the player’s rotation.

transform.right is relative to the rotation of the transform, if you dont want the raycast to follow the transform rotation if think you should try using Vector3.right insted, which is the same as using new Vector3(1, 0, 0)
I hope this helps you :wink:

Ok I found your problem, you were multiplying a global direction with a local rotation, try with this :

Debug.DrawRay(raycastOriginPoint, transform.TransformDirection(Vector3.right + Vector3.up), Color.blue);
         Debug.DrawRay(raycastOriginPoint, transform.TransformDirection(Vector3.right), Color.blue);
         Debug.DrawRay(raycastOriginPoint, transform.TransformDirection(Vector3.right + Vector3.down), Color.blue);