v1.2.0
public look(target: Vec3) {
let q_tmp: Quat = this.lookRotation(target);
tween(this.node)
.to(0.8, { rotation: q_tmp })
.start()
}
public lookRotation(target: Vec3) {
const dir = target.clone().subtract(this.node.getWorldPosition()).normalize();
const q_tmp = new Quat()
Quat.rotationTo(q_tmp, v3(0, 0, 1), dir)
return q_tmp;
}
一个递归,让人物沿指定点运动,look方法调整人物朝向,
private follow(points: Array): void {
this.animation.play(“walk");
let self = this;
let fun = function () {
if (0 === points.length) {
return;
}
let to: Vec3 = points.shift();
self.look(to);
tween(self.node)
.to(1, { position: to },
{
onComplete: () => {
self.dopatrol(); //生成points,调用follow方法
} else {
fun();
}
}
})
.start();
}
fun();
}
正常漫游,是这样的:

偶尔会变成这样,这只是个中间态,像个卡片。没有scale设置,会是啥原因啊?
