-
Creator 版本: 3.6.2
-
目标平台:google chrome
-
重现方式:场景里面自带node 跟动态创建node
private JoystickLogic(touch: Touch | null) {
if (!this._curTouch) {
this._curTouch = touch;
}
const location = touch?.getUILocation()!;
let touchPoint = this._bg.getComponent(UITransform)?.convertToNodeSpaceAR(new Vec3(location.x, location.y));
let touchPoint1 = this.bg.getComponent(UITransform)?.convertToNodeSpaceAR(new Vec3(location.x, location.y));
console.log(this._bg.getComponent(UITransform),this.bg.getComponent(UITransform))
console.log(touch?.getUILocation(), touchPoint,touchPoint1);
const targPos = this.calcTargPos(touchPoint || Vec3.ZERO);
this._gamePad.setPosition(targPos);
this.SetGamePadDir(ccf.pSub(targPos, this._joystickOrigin));
}
_bg是代码动态创建的 也赋值了UITransform
bg是本身就在canvas上的
然后convertToNodeSpaceAR这个方法 _bg这边永远是0 bg这边就是有数值
