rapier.js icon indicating copy to clipboard operation
rapier.js copied to clipboard

intersectionsWithRay on empty ColliderSet causes RuntimeError

Open canadaduane opened this issue 3 years ago • 1 comments

When I query for intersectionsWithRay on an empty ColliderSet, I get the following RuntimeError:

cb4a7832f88eb109b422.module.wasm:0x109724 Uncaught RuntimeError: unreachable
    at http://localhost:8080/build/cb4a7832f88eb109b422.module.wasm:wasm-function[803]:0x109724
    at http://localhost:8080/build/cb4a7832f88eb109b422.module.wasm:wasm-function[901]:0x10d9ac
    at http://localhost:8080/build/cb4a7832f88eb109b422.module.wasm:wasm-function[1248]:0x115602
    at http://localhost:8080/build/cb4a7832f88eb109b422.module.wasm:wasm-function[1181]:0x1148e8
    at http://localhost:8080/build/cb4a7832f88eb109b422.module.wasm:wasm-function[1250]:0x115666
    at http://localhost:8080/build/cb4a7832f88eb109b422.module.wasm:wasm-function[1011]:0x110f3e
    at http://localhost:8080/build/cb4a7832f88eb109b422.module.wasm:wasm-function[115]:0xa2fcc
    at rawquerypipeline_intersectionsWithRay (http://localhost:8080/build/cb4a7832f88eb109b422.module.wasm:wasm-function[734]:0x1055fd)
    at RawQueryPipeline.intersectionsWithRay (http://localhost:8080/build/0.0.js:5740:105)
    at QueryPipeline.push.../node_modules/@dimforge/rapier3d/pipeline/query_pipeline.js.QueryPipeline.intersectionsWithRay (http://localhost:8080/build/0.0.js:3244:18)

In my world loop, I need to check that colliders.len() > 0 to proceed:

    const colliders = this.physics.world.colliders;
    if (colliders.len() > 0) {
      this.physics.world.intersectionsWithRay(
        colliders,
        rayDown,
        MAX_GROUND_TOI,
        true,
        AVATAR_INTERACTION,
        (isect) => {
          // ... callback code ...
          return true;
        }
      );
    }

canadaduane avatar Apr 12 '21 04:04 canadaduane

I believe this is no longer necessary, as the colliders are no longer passed explicitly.

canadaduane avatar Jan 22 '22 11:01 canadaduane