[]射线BUG

把下面这段代码覆盖http://layaair.ldc.layabox.com ... ample里的代码后执行代码是可以的,但是自己建一个空项目,运行后就会报错,这是不是引擎BUG,下面附上示例,麻烦测试一下,我用的是1.7.1JS版的
function MousePickingScene() {
MousePickingScene.super(this);
this.ray = new Laya.Ray(new Laya.Vector3(0, 0, 0), new Laya.Vector3(0, 0, 0));
this.point = new Laya.Vector2();
this._outHitInfo = new Laya.RaycastHit();
this.phasorSpriter3D = new Laya.PhasorSpriter3D();

this.camera = this.addChild(new Laya.Camera(0, 0.1, 100));
this.camera.transform.translate(new Laya.Vector3(0, 1, 3));
//camera.addComponent(CameraMoveScript);
this.camera.clearColor = null;
}
Laya.class(MousePickingScene, "MousePickingScene", Laya.Scene);


MousePickingScene.prototype.lateRender = function (state) {
MousePickingScene.__super.prototype.lateRender.call(state);
//从屏幕空间生成射线
this.point.elements[0] = Laya.stage.mouseX;
this.point.elements[1] = Laya.stage.mouseY;
this.camera.viewportPointToRay(this.point, this.ray);

//射线检测,射线相交的<最近物体>,最大检测距离30米,只检测第13层
Laya.Physics.rayCast(this.ray, this._outHitInfo, 30, 13);
if (this._outHitInfo.distance !== -1){
alert("666");
}
this.phasorSpriter3D.begin(Laya.WebGLContext.LINES, state);
//绘出射线
this.phasorSpriter3D.line(this.ray.origin.x, this.ray.origin.y, this.ray.origin.z, 1.0, 0.0, 0.0, 1.0, 0, -1, 0, 1.0, 0.0, 0.0, 1.0);
this.phasorSpriter3D.end();
}

Laya3D.init(0, 0,true);
Laya.stage.scaleMode = Laya.Stage.SCALE_FULL;
Laya.stage.screenMode = Laya.Stage.SCREEN_NONE;
Laya.Stat.show();
Laya.stage.addChild(new MousePickingScene());
已邀请:

cuixueying

赞同来自:

请使用最新版本引擎1.7.2beta或1.7.1正式版,用最新版本的引擎接口测试下,如果还有问题,我们再沟通!

要回复问题请先

商务合作
商务合作