Raycast is not being called

In the game im making, the player is being chased by bulls.

i’m trying to make one wild bull hit a pedestrian(NPC) on the road by making a raycast. The problem is that the raycast is not being called. I have the bull tagged as obstacle. Here is the script im using.

using UnityEngine;
using System.Collections;

public class BullCharge : MonoBehaviour {

	private void Update()
		RaycastHit hit;
	    if (Physics.Raycast(transform.position, transform.forward, out hit, 100))
			if(hit.collider.gameObject.tag == "Obstacle")
				print ("Road Kill");

add these
at the end up Void Update() function

Debug.log(hit.transform.gameobject) //if it returns null you hit nothing
Debug.log(hit.transform.gameobject.tag) //perhaps you messed up the tag confirm its 
Obstacle. Not by the way Obstacle

comment out the if(hit.collider.gameobject.tag == "Obstacle")
again this is to see if the object is just mistagged



that will draw a ray from the car to ideally right in front of it, to the cow
if it doesnt there is something wonky about your transform.forward direction.