[0]2D转3D坐标

this.camera = new Laya.Camera(0, 0.3, 8);
this.camera.transform.translate(new Laya.Vector3(0, 0, -8),false);
this.camera.transform.rotation = new Laya.Quaternion(0,-1,0,-0);
this.camera.clearFlag = Laya.BaseCamera.CLEARFLAG_DEPTHONLY;
this.camera.orthographic = true;
this.camera.clearColor = null;
this.addChild(this.camera);

//设置正交摄像机的视口后
this.camera.viewport = new Laya.Viewport(160,34,1600,900);
//转换出的3D坐标位置有偏移
var out = new Laya.Vector3();
this.camera.convertScreenCoordToOrthographicCoord(new Laya.Vector3(100,100,0),out);
 
未设置视口时,转换出的3D坐标是正确的
 
已邀请:

要回复问题请先

商务合作
商务合作