是要模仿镜头移动功能吗,这样可以
onAwake() {
const self = this;
self.gameObj = self.owner as Laya.Sprite;
Laya.Physics.I.worldRoot = self.gameObj;
this.cameraRect = new Laya.Rectangle(0, 0, 2000, 1000);
this.gameObj.scrollRect = this.cameraRect;
}
onUpdate() {
this.cameraRect.x = this.target.x - 400;
this.cameraRect.y = this.target.y - 400;
}