Both Points
and Line
implement a raycast()
function/method. They both use a threshold/precision:
I think the API is a bit inconsistent and they could both be named either threshold or precision and also they could both be set in the Raycaster
in the same way. Right now you have to:
raycaster.linePrecision = 42;
raycaster.params.Points.threshold = 42;
Also, only linePrecision
is documented.
Same API for all thresholds/precisions. It seems the .params
attribute is more complete/flexible, so I would say:
raycaster.params.Line.threshold = 42;
raycaster.params.Points.threshold = 42;
That means removing the linePrecision
attribute.
Related #5366.
Just to be clear, I am not suggesting changing the units of the raycaster precision. I think world units are just fine. :blush:
Agreed, a common approach for Points
and Lines
is desirable. I think I vote for enhancing Raycaster.params
, too. And deprecating Raycaster.linePrecision
.
So will the convention be to house class-specific raycast parameters at Raycaster.params.<classname>
? I'm thinking about Line2 raycasting which currently doesn't respect linePrecision
because it's in world units. So it would be nice to support something like Raycaster.params.line2.pixelPrecision
.
Maybe a topic for another issue but it might be nice to provide worldPrecision
and pixelPrecision
for something like Points
considering they can be rendered with and without perspective attenuation.
So will the convention be to house class-specific raycast parameters at Raycaster.params.
?
I would say yes.
Agreed, a common approach for
Points
andLines
is desirable. I think I vote for enhancingRaycaster.params
, too. And deprecatingRaycaster.linePrecision
.
馃憤
@Peque Do you want to make a PR with your proposed change? 馃槆
@Mugen87 I have very little experience with JS, but I will try. It is the least I can do for this project and the community behind it, who already helped me a couple of times when I felt lost. :heart:
Hopefully, I will be able to find some time to work on this before next week.
Opened https://github.com/mrdoob/three.js/pull/18648. All feedback is welcome. :heart:
Most helpful comment
@Mugen87 I have very little experience with JS, but I will try. It is the least I can do for this project and the community behind it, who already helped me a couple of times when I felt lost. :heart:
Hopefully, I will be able to find some time to work on this before next week.