[0]physicsSimulation.rayCast在新版本里选取不准确
在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);
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);
没有找到相关结果
已邀请:
要回复问题请先登录
4 个回复
151*****601
赞同来自:
Yan
赞同来自:
zhangxy
赞同来自:
shiyang
赞同来自:
mouseY / Laya.stage.clientScaleY