Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I just started using iTween as part of my day/night cycle. I'm trying to move the sun and moon along a curve, but I want have the sun/moon start at a specific location depending on the time of day. That would mean beginning the MoveTo() function from, say, the 3rd node instead of the 1st node, but I can't figure out how to access specific nodes.

If that's not possible, is there some other workaround? I thought of making several paths of two nodes each and calling the next path once the first one finishes, but then the object has to move in a series of straight lines.

share|improve this question
1  
You could create a second array of points and use your original data to populate that in your desired order. If all you need is a simple orbit, though, it might be easier to attach the sun/moon to a faraway pivot point (like a parent transform), then rotate around that. –  rutter May 22 at 18:59

1 Answer 1

You must call iTween once. You would then call it each update. For example:

 public class doubleTween : MonoBehaviour {

     // Use this for initialization
     void Start () {
         iTween.RotateBy(gameObject,iTween.Hash("x", .25,"time",2, "easeType"
             , "easeInOutQuad", "loopType", "pingPong", "delay", .2));

         iTween.MoveTo(gameObject,iTween.Hash("x",6,"time",4,"loopType","pingPong"
             ,"delay",.4,"easeType","easeInOutQuad"));
     }

     // Update is called once per frame
     void Update () {

     }
 }

Hope this helps!

share|improve this answer
    
Thanks, but I'm already only calling it once. The problem is: let's say the sun should start on the left side of the screen if it's 10:00am in game time, and it should start on the right side if it's 5:00pm. Both 10:00am and 5:00pm can be represented by a node, but how can I tell the sun to begin at 5:00pm rather than 10:00pm? –  eternal May 22 at 19:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.