这里的主要问题就是stencil 在创建的时候没有给他添加父亲,他没有父亲,在改变属性的时候转换矩阵变了,世界坐标里的位置也就变了。
修复如下:
ctor: function (stencil) {
stencil = stencil || null;
cc.Node.prototype.ctor.call(this);
this._stencil = stencil;
// 在这里给他指定个父亲
this._stencil.parent = this;
if (stencil) {
this._originStencilProgram = stencil.getShaderProgram();
}
this.alphaThreshold = 1;
this.inverted = false;
this._renderCmd.initStencilBits();
},