[LayaAir 2.0]想用camera做一个类似照相机的功能

主camera的视角不变 想通过第二个camera完成3D场景的拍照 然后生成拍照时场景状态的image给2DUI使用
已邀请:

熊猫大侠

赞同来自:

            //选择渲染目标为纹理
            this.renderTargetCamera.renderTarget = new RenderTexture(Laya.stage.width, Laya.stage.height);
            //渲染顺序
            this.renderTargetCamera.renderingOrder = -1;
            //清除标记
            this.renderTargetCamera.clearFlag = BaseCamera.CLEARFLAG_SKY;
            var rtex = new Texture(((<Texture2D>(this.renderTargetCamera.renderTarget as any))), Texture.DEF_UV);
            this.imgSp = new Sprite();
            this.imgSp.graphics.clear();
            this.imgSp.cacheAs = "bitmap";
            Laya.stage.addChild(this.imgSp);
            this.imgSp.graphics.drawTexture(rtex);

熊猫大侠

赞同来自:

有做过类似功能的同学吗

该问题目前已经被锁定, 无法添加新回复

商务合作
商务合作