Door only opening once on Raycast

I’m trying to get a door to open properly - using an animation, from both directions. At the moment, I’ve gotten it to open going one direction, but then it refuses to open again from the other. The script is very simple:

		RaycastHit hit;
	if (Physics.Raycast(transform.position, Vector3.forward, out hit, 2.0F))
		hitObject = hit.transform.parent;
		string objectName =;

		switch (objectName)
			case "door_and_Frame":
				hitObject.animation.Play("Take 001");

Is there any recommended way to reset the raycast - or object, so that it detects it again coming through the door a second time or in the opposite direction?

If you are trying to open the door by getting close to it, then you should use colliders/triggers.

Physics.RayCast is usually used to detect the presence of an object in front of the ray.

But in you current case, after you open the door once, try to get away from the door with a long distance without looking at it. Then come back and see if it triggers again.