Skip to content

Commit

Permalink
Merge pull request #14 from oasis-engine/fix/raycast
Browse files Browse the repository at this point in the history
fix(raycast): entity tag has changed to layer
  • Loading branch information
GuoLei1990 authored Jan 28, 2021
2 parents 4446f63 + f14de5e commit 8263cb0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/core/src/raycast/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -36,7 +35,7 @@ const _tempShpere = new BoundingSphere();
continue;
}

if (!(collider.entity.tag & tag)) {
if (!(collider.entity.layer & tag)) {
continue;
}
const hit = new RaycastHit();
Expand Down

0 comments on commit 8263cb0

Please sign in to comment.