From f14de5eff9b391c76dbece3ab9703065b2927768 Mon Sep 17 00:00:00 2001 From: gz65555 Date: Thu, 28 Jan 2021 17:08:46 +0800 Subject: [PATCH] fix(raycast): entity tag has changed to layer --- packages/core/src/raycast/index.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/core/src/raycast/index.ts b/packages/core/src/raycast/index.ts index 912d1a7d09..b9710a8c84 100644 --- a/packages/core/src/raycast/index.ts +++ b/packages/core/src/raycast/index.ts @@ -23,8 +23,7 @@ const _tempShpere = new BoundingSphere(); * @param _outPos - The point where the ray intersects * @return The collider that has been intersecting */ -(Scene.prototype as any).raycast = function (_ray, _outPos: Vector3, tag: Layer = Layer.Everything) { - const ray = new Ray(_ray.origin, _ray.direction); +(Scene.prototype as any).raycast = function (ray: Ray, _outPos: Vector3, tag: Layer = Layer.Everything) { const cf = this.findFeature(ColliderFeature); const colliders = cf.colliders; @@ -36,7 +35,7 @@ const _tempShpere = new BoundingSphere(); continue; } - if (!(collider.entity.tag & tag)) { + if (!(collider.entity.layer & tag)) { continue; } const hit = new RaycastHit();