[]Laya3D鼠标检测,3d对象被添加到场景,然后又被移除,还能通过Ray进行碰撞检测么?
var outHitAllInfo:Vector.<RaycastHit> = new Vector.<RaycastHit>();
point.elements[0] = MouseManager.instance.mouseX;
point.elements[1] = MouseManager.instance.mouseY;
ray.direction.x = 0;
ray.direction.y = 0;
ray.direction.z = 0;
ray.origin.x = 0;
ray.origin.y = 0;
ray.origin.z = 0;
handCamera.viewportPointToRay(point, ray);
Physics.rayCastAll(ray, outHitAllInfo);
var hit:RaycastHit = outHitAllInfo[0];
一直无法获得正确的点击对象,后来发现获得了多个碰撞对象,其中第一个是一个parent为null的sprite3D对象
point.elements[0] = MouseManager.instance.mouseX;
point.elements[1] = MouseManager.instance.mouseY;
ray.direction.x = 0;
ray.direction.y = 0;
ray.direction.z = 0;
ray.origin.x = 0;
ray.origin.y = 0;
ray.origin.z = 0;
handCamera.viewportPointToRay(point, ray);
Physics.rayCastAll(ray, outHitAllInfo);
var hit:RaycastHit = outHitAllInfo[0];
一直无法获得正确的点击对象,后来发现获得了多个碰撞对象,其中第一个是一个parent为null的sprite3D对象
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
Monica - 知识达人
赞同来自: reven1983