johnatm / itween

Automatically exported from code.google.com/p/itween
1 stars 2 forks source link

MoveTo() with a "path" and "orienttopath" causes a flip at the end of the path #20

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Example project shows issue

Original issue reported on code.google.com by pixelplacement on 11 Aug 2010 at 5:17

GoogleCodeExporter commented 8 years ago
Fixed! Thank you "JFo"!

Original comment by pixelplacement on 13 Aug 2010 at 6:09

GoogleCodeExporter commented 8 years ago
I still see problems at the end of MoveTo on a path if I do not use "linear" 
easing. I am tweening along a spline with the following params:

iTween.MoveTo(gameObject, iTween.Hash("path", nodesToFollow.pathNodes, "time", 
20, "looktime", 0, "lookahead", 0.05f, "orienttopath", true, "axis", "y", 
"easetype", "easeInOutSine"));              

The path is an array of pretty much any 3+ transforms

 Using Sine easing make it fairly apparent. Looks like the tweened object quickly aligns to world -Z at the end of a path. Looks ok with "linear" and looks fine during the tween. This is with iTween 2.0.44

I'm guessing the use of the transform.lookat function fails when using points 
at the very end of the spline, the look from and look to points are the same. 
Getting undefind or NaN in there somewhere I bet. You can "work around" or at 
least test this by artificially clamping the ease call in the beginning of 
ApplyMoveToPathTargets() to .99 instead of 1 - so the tweened object never 
quite hits the end of the path, but the looktarget can still be ahead on the 
path. 

Original comment by wilksm...@gmail.com on 31 May 2011 at 7:02