用3.0 联系2.x的示例,位置就是无法更新了
update(dt: number) {
if (this.accLeft) {
this.xSpeed -= this.accel * dt;
}
else if (this.accRight) {
this.xSpeed += this.accel * dt;
}
if (Math.abs(this.xSpeed) > this.maxMoveSpeed) {
this.xSpeed = this.maxMoveSpeed * this.xSpeed / Math.abs(this.xSpeed);
}
this.curPos = this.node.getPosition()
this.deltaPos = new Vec3(this.xSpeed * dt, 0, 0)
this.curPos = new Vec3((this.curPos.x + this.xSpeed * dt) as number, this.curPos.y, this.curPos.z)
//curPos的x也在变 ,可是setPosition无效
this.node.setPosition(this.curPos);
}
求大神们指教

