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"
));
opendoor.Play();
}
}
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"
));
opendoor.Play();
}
}
Comment