1.这个老师讲课挺斗,还2B程序员、普通程序员、文艺程序员
.
iTween.MoveTo(ball, iTween.Hash("position", waypoints[pointi], "speed", 10f, "easetype", "linear", "oncomplete", "MoveToPoint"));2.这句总是忘记:
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);3.CallBack回调函数
iTween.MoveTo(ball, iTween.Hash("position", waypoints[pointi], "speed", 10f, "easetype", "linear", "oncomplete", "MoveToPoint"));机制:itween使用unity里的SendMassage回调
里面用Onstart、OnUpdate、oncomplete
回调是,去执行上面ball物体上的函数,但是MoveToPoint并不是ball上的函数,ball上没脚本;
这时有两个办法,一个是在ball上挂一个脚本,二个是用Oncompletetarget
4.抛物线案例
用cube,不用plane,主要是因为cube上是box collider,而plane上是mesh collider,后者消耗资源多,类似Terrain
5.用itween,不用直接等于鼠标的位置
iTween.MoveUpdate(target,new Vector3(hit.point.x,0.1f,hit.point.z),0.1f);0.1f,,,缓动,柔和,比直接让plane的坐标等于,鼠标射线的坐标,要好
6.注意:要把plane的碰撞关掉
7.itween的曲线运动:path
8.小球抛物线发射出来,会导致,连续点击时,发射不了,因为plane上都是小球,这是有2种方法
一种是用tag,另一种是把collider去掉
本文介绍了Unity中使用iTween进行物体运动控制的方法,包括常见运动代码示例、回调函数的应用、路径运动实现及解决连续点击发射问题等。

2万+

被折叠的 条评论
为什么被折叠?



