今天在itween里用path,实现平滑缓动,却发现目标跳跃的很厉害。仔细检查代码发现我先给目标的position赋值为(0,0,0),然后再
iTween.MoveTo(this.gameObject, iTween.Hash("path", path, "easeType", this.easeType, "loopType", this.loopType, "time", this.time, "delay", this.delay, "islocal", this.local));
这样就导致改变了path的起始点。
即便先设置目标的位置,在按照path缓动时也会从0,0点开始。就如同path会自动在开头增加一个0,0点。
这是因为没有指定动画是否从当前位置启动,系统默认为true,需要设置属性movetopath为false,默认是true,会从目标的当前位置移动。
for whether to automatically generate a curve from the GameObject's current position to the beginning of the path. True by default。
参考这个帖子:
http://answers.unity3d.com/questions/478035/itween-makes-a-weird-start-on-the-path.html