在2.8.0版本里raycast是准确的,把类库升级到最新的2.12.2以后,可以选中但是不准确了,有偏移,目前无奈只能回退到2.8.0版本
let touchPoint:Laya.Vector3 = new Laya.Vector3();
let screenPoint:Laya.Vector2 = new Laya.Vector2();
screenPoint.x = Laya.MouseManager.instance.mouseX;
screenPoint.y = Laya.MouseManager.instance.mouseY;
// console.log(screenPoint);
let touchRay:Laya.Ray = new Laya.Ray(new Laya.Vector3(0, 0, 0), new Laya.Vector3(0, 0, 0));
this.camera.viewportPointToRay(screenPoint, touchRay);
let hr:Laya.HitResult = new Laya.HitResult();
this.m_scene3d.physicsSimulation.rayCast(touchRay, hr, 10000);