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 = hitObject.name;
switch (objectName)
{
case "door_and_Frame":
hitObject.animation.Play("Take 001");
break;
}
}
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?