在之前的 Cocos Creator 2.x 的教程中,修改节点的水平位置是通过:
this.node.x += this.xSpeed * dt
在 Cocos Creator 3.0 教程中,是不是下面这样:
this._curPostion.x += this._xSpeed * delta
this.node.setPosition(this._curPostion)
在 Creator 3.0 有没有更简单的方式修改一个节点 postion 的水平分量?
在之前的 Cocos Creator 2.x 的教程中,修改节点的水平位置是通过:
this.node.x += this.xSpeed * dt
在 Cocos Creator 3.0 教程中,是不是下面这样:
this._curPostion.x += this._xSpeed * delta
this.node.setPosition(this._curPostion)
在 Creator 3.0 有没有更简单的方式修改一个节点 postion 的水平分量?
就是set ,直接赋值x多危险,unity也是用set
是指这样吗?
this._curPostion.set(
this._curPostion.x + this._xSpeed * delta,
this._curPostion.y,
this._curPostion.y
)
对于 Vec3,如果我们只是想修改其中一个分量也是用 set 吗?感觉这样会多一些不必要的样板代码 ==