Raycasting from object rotation?

Hello, I have a floppy “Gun” and I want a ray to cast from the tip of it, and while a ray does cast from the tip, it doesn’t correlate with the rotation.

Your raycasting using the camera ray probably, what you need to do is create a ray like this:

public Transform gunBarrel;

Ray ray = new Ray(gunBarrel.position, gunBarrel.forward);