Welcome to our community forums, full of great people, ideas and excitement. Please register if you would like to take part.

This is extra text with a test link..

Register Now


No announcement yet.

Door Not Closing

  • Filter
  • Time
  • Show
Clear All
new posts

  • Door Not Closing

    I was making my ITween door and was having trouble figuring out how to have the door close after it is opened. I tried using a loop but I couldn't figure out how to only loop it once rather than many times.
    I tried each of the Rotate options (RotateTo, RotateBy, and RotateFrom) but I keep getting the same results. If anyone knows how to do this I would appreciate the help!

    Here's my code:

    public class SwingDoorScript : MonoBehaviour
    public AudioSource opendoor;

    public float doorswingtime;
    private void OnTriggerEnter(Collider other)
    iTween.RotateFrom(gameObject, iTween.Hash(
    "rotation", new Vector3 (0,90,0),
    "islocal", true,
    "time", doorswingtime,
    "easetype", "linear"

  • #2
    Remember the sister tool to OnTriggerEnter is OnTriggerExit. Using another method with OnTriggerExit will allow you to close the doors after the player has passed through them - but remain open while the player is still inside.