Raycast not hitting collider

Hello, I am trying to add spotting similar to battlefield 3 and 4. All the players have a box collider around them that is on the layer “tagging.” I have the player send out a raycast whenever they press ‘E’ and a layermask on the ray so that it only collides with the tagging layer. It works fine when I am relatively close to the player. However, when I get more than 10-50 units away from him, it doesnt detect the collision at all. Also, the raycast maxDistance is over 600 so that shouldnt be the problem.

Code:

void RpcSendRay(){
	RaycastHit shot;
	Debug.Log (transform.name + " sent ray"); //this is always logged
	if(Physics.Raycast (raycastItem.position, raycastItem.forward, out shot, 600f, mask.value)){
		Debug.Log (shot.transform.name + " ray hit"); //I never get to this point unless really close
		Debug.Log (shot.distance);
		PlayerTagging pt = shot.transform.GetComponent<PlayerTagging> ();
		if (pt != null) {  //this if statement just makes sure they have the script and then tags them
			if (pt.GetComponent<Player> ().isLocalPlayer) {
				return;
			}
			Debug.Log (shot.transform.name + " getting tagged");
			pt.tagMe ();
		}
	}
}

It could be that your forward vector is offset slightly, and could explain why it works at a close distance, and not at a further one, where the ray is actually going in a direction around the gameObject you’re attempting to hit.

To see if this is in fact the issue, normalize your forward vector, and see if the issue is still there.

if(Physics.Raycast (raycastItem.position, raycastItem.forward.normalized, out shot, 600f, mask.value))
{
[...]
}

Alrighty, I got it. I’m not sure why but it is because I send out the ray in the clientRpc. I just moved it so that it is called locally and then it calls a command/rpc if it actually hits someone.