Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

iTween path switching problem

Discussion in 'Scripting' started by freaksed, May 3, 2011.

  1. freaksed

    freaksed

    Joined:
    Sep 15, 2010
    Posts:
    22
    I have a road object with a bunch of iTween paths. Each path starts where the last ends, and after the first path there are 2 to choose from (though I haven't set up choosing yet, it is just going through a set choice now). That was to clarify why I don't just use one long path. When the object (a camera) gets to the end of each path it uses "oncomplete" to choose a new path and begin moving along it. The problem is that when it begins a new path it slowly moves in the wrong direction for a second before moving along the new path.

    code sample:

    function ChoosePath(){
    segment++;
    iTween.MoveTo(rusty, {"path" : road.GetPath("seg"+segment+"g"), "speed" : 100, "easetype" : "linear", "oncomplete" : "ChoosePath", "oncompletetarget" : gameObject});
    }
     
  2. freaksed

    freaksed

    Joined:
    Sep 15, 2010
    Posts:
    22
    "movetopath" causes this while it tried to find the path beginning. turned it off and it fixed it.