Hi All!
I have a problem with setting direction while moving on path, how I can set direction in iTween tools (rotations to object) like in SplineController, i.e. while object flying it’s looking to path directions smooth…
Hi All!
I have a problem with setting direction while moving on path, how I can set direction in iTween tools (rotations to object) like in SplineController, i.e. while object flying it’s looking to path directions smooth…
Do you mean to have the object look where it’s going? If so check the documentation for “orienttopath”.
Ok, so, I bought the path example, but unfortunately I don’t think itween does what I wanted it to do. If I wanted to have a rollercoaster on a track, and put the rollercoaster on the track, then have it do a loop, it doesn’t work because it doesn’t orient to the spline. Anychance I am just overlooking a simple way to do this or am I going to have to break out math books and do my own spline class?
Using “orientToPath” will do exactly what you are asking for. Try also adding a “lookTarget” of around .2 and let me know.
PutOnPath BACK TO TOP
Puts a GameObject on a path at the provided percentage
PutOnPath(GameObject target, Vector3[ ] path, float percent)
PutOnPath(GameObject target, Transform[ ] path, float percent)
PutOnPath(Transform target, Vector3[ ] path, float percent)
PutOnPath(Transform target, Transform[ ] path, float percent)
PutOnPath doesn’t have an oreient to path option. I have the look target, and it will look around the curves, but if I go upside down, the character flips.
iTween.PutOnPath(thisTransform.gameObject, splines, curPosition);
thisTransform.LookAt(iTween.PointOnPath(splines, curPosition + 0.05));
I just need it to orient to the normal of the path. So if I have a loop, when I am upside down, the Y vector will be pointing in -Y world space. Just noticed your post about the visual itween editor, apparently it does have a orient to path, I am testing to see if that does what I need it to do. Thank you for itween, very nice, love it.
LookUpdate, which is used internally for orienttopath, has default values for “looktime” which are probably not going to do what you want for paths orients (but which work well for non-path orient looks).
So if you want to orient to a path, a looktime of 0 will do it instantly I would guess, and 0.2 will do it smoothly but quickly.
If you don’t put a looktime in, you get seemingly random results as it is trying to look at your path but over a nonsense time.
Also, a lookahead value of 1.0 looks at the end of the path, 0.5 looks half way down the path, and 0.01ish looks where you are right now [a value of zero won’t work as there is no move vector]. Default is 0.05 which works well.
pixelp - possibly worth pointing out that looktime is pretty much required for path orients in the docs, and that 0.2 is a good starting point.