What's up with my raycast script?

Trying to write a script where a first person camera will detect if an enemy is within a certain range of the center of the camera.

    public bool inPlayerSight;
	public float playerSightDistance;

	private Animator anim;
	private HashIDs hash;
	private Transform cam;
	private bool spotted;
	private GameObject enemy;

	void Awake(){

		anim = GetComponent<Animator>();
		hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIDs>();
		cam = Camera.main.transform;
		enemy = GameObject.FindGameObjectWithTag(Tags.enemy);


	void Update(){

        RaycastHit hit;

		if(Physics.Raycast(cam.transform, cam.forward, out hit, playerSightDistance)){

			Debug.DrawLine(cam.transform, playerSightDistance, Color.green, 1000);

			if(hit.collider.gameObject == enemy){
				spotted = true;
				Debug.Log("Enemy spotted");




But I’m getting some errors.

The best overloaded method match for `UnityEngine.Physics.Raycast(UnityEngine.Vector3, UnityEngine.Vector3, float, int)’ has some invalid arguments

For line 24 and 26


Argument #1' cannot convert UnityEngine.Transform’ expression to type `UnityEngine.Vector3’

For the same lines

You sending in a Transform while the Raycast expects a Vector3. transform.position is probably what you want there.