- Home /
Zeppelin flying controls with itween
I'm trying to make 3 lines of air ways which a zeppelin can fly towards the secreen (z axis). When player pushes left and right buttons I run these lines to animate zeppelin :
void Right()
{
iTween.MoveTo(gameObject, iTween.Hash("x", 18, "easeType", "easeInOutExpo", "loopType", "none", "delay", .1));
iTween.RotateTo(gameObject, iTween.Hash("y", 25,"z", -20, "easeType", "linear", "time", 1));
iTween.RotateTo(gameObject, iTween.Hash("y", 0, "z", 0, "easeType", "easeOutQuad", "time", 1, "delay", 0.8));
}
void Left()
{
iTween.MoveTo(gameObject, iTween.Hash("x", -18, "easeType", "easeInOutExpo", "loopType", "none", "delay", .1));
iTween.RotateTo(gameObject, iTween.Hash("y", -25,"z", 20, "easeType", "linear", "time", 1));
iTween.RotateTo(gameObject, iTween.Hash("y", 0, "z", 0 , "easeType", "easeOutQuad", "time", 1, "delay", 0.8));
}
Zeppeling needs to fly forward but when I press left and right it also needs to go side ways with this yawning animation. What happens is zeppelin flys through and when I press left it stops, goes left and continues flying.
I also tried rigidbody and addforce to a parent object. Samething happened there. Flys but stops when changing lane.
Can anybody show me a clue to how to do this ?
Thx in advance.
It has been a long while since I've used iTween but I think you might have better luck using $$anonymous$$oveBy() or $$anonymous$$oveAdd() ins$$anonymous$$d of $$anonymous$$oveTo() for the turn.
Your answer
![](https://koobas.hobune.stream/wayback/20220613091825im_/https://answers.unity.com/themes/thub/images/avi.jpg)