After updating from 108 to 121, Raycaster always returns zero intersections.
The reason is that Raycaster now only casts against objects that have the same matching Layer
(Object3D.layers
).
So if your app uses layers, you now need to either
- make sure
Raycaster
has the same layers as all the objects youâre raycasting against - or call
raycaster.layers.enableAll()
to have it operate with all layers (i.e. regardless of layer).
@Mugen87 It wouldâve been great if Raycaster had .layers.enableAll()
by default. Not too late to change it, so anyone who still hasnât updated wonât have a broken app.
Similar to Object3D
, Raycaster
only enables the default layer. In this way, intersection testing works similar to the visibility tests with cameras. Hence, I donât think raycaster should call enableAll()
.
@Mugen87 I know, but it isnât backwards compatible (with apps that are already using layers).
Thatâs why we have a migration guide. We try to avoid breaking changes as good as we can but sometimes they are required to achieve more consistent solutions.
@Mugen87 I think raycaster
needs to be a public variable, so that if someone changes the layers
of a TransformControls
instance, they can also changes the layers
of its raycaster
.
Here are the needed changes (I am not allowed to make pull requests): https://github.com/mrdoob/three.js/compare/dev...trusktr:patch-21
Do I need to build and commit the build output? If so, I can do that if itâs more convenient for you.
EDIT: Oops, I did it backwards, I shouldâve modified the file in js/
instead of jsm/
. I can update that.
EDIT: Added the type def in .d.ts. Still need to swap over to the js/
file.
@Mugen87 Iâm confused by CONTRIBUTING.md
. It says:
- If you modify files in
examples/js
directory, then donât perform any changes in theexamples/jsm
, JavaScript modules are auto-generated via runningnode utils/modularize.js
.
However, I see in a pull request
That the jsm/
file was directly modified, and not the js
/ file.
Can you please advise?
Newley created files are only located in the examples/jsm
directory. For existing files (like TransformControls
) you have to modify the examples/js
version and generate the module via node utils/modularize.js
.
Ah, so those folders can be out of sync then.
@Darkladen mentioned that he noticed the js/
and jsm/
folders were out of sync (differing set of classes) when he had some confusion trying to use both scripts and modules:
The js/jsm process is not so clear, and CONTRIBUTING.md
made it seem as if js/
is the source of truth.
I pushed the change to the js/
folder instead of jsm/
folder.
Hereâs the final patch: Comparing mrdoob:dev...trusktr:patch-21 ¡ mrdoob/three.js ¡ GitHub
Hope that helps.
EDIT: I didnât update Chinese docs.
Do I need to run that part manually?
Yes.
Sorry for the confusion but the ES5/ES6 topic was lately discussed and a few things have changed again. Itâs indeed a bit complicated for first time contributors to get everything 100% right.