Raycasting using local space instead of global

I have a turret casting a raycast in the positive Z (vector3.forward) direction. The turret rotates around slowly, and when it sees the player (when the raycast hits the player collider) it starts shooting. However instead of the raycast rotating with the turret, it casts into the global Z direction. The turret is facing the local Z direction at all times, so what I need is for the raycast to shoot into local Z.
My question is, how can I raycast using a local direction, not global?
I tried using InverseTransformDirection, which is apparently supposed to convert the vector3 to local space, but that just raycasts in the -Z global direction. So is there no way to do a local raycast?

This is my current code for the raycasting:

	if (Physics.Raycast (this.transform.position,Vector3.forward, hit, 10)) {

Ok, I did a little more digging and found that apparently I should be using transform.forward instead of Vector3. I tried it and it worked! :smiley:

Hey, Thanks!