question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inconsistent raycast precision API

See original GitHub issue
Description of the problem

Both Points and Line implement a raycast() function/method. They both use a threshold/precision:

https://github.com/mrdoob/three.js/blob/138d25dbd138f9feedbb20ade26f104155a50d8f/src/objects/Points.js#L37-L59

https://github.com/mrdoob/three.js/blob/138d25dbd138f9feedbb20ade26f104155a50d8f/src/objects/Line.js#L94-L117

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.

Proposal

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.

Three.js version
  • Dev
  • r113

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Pequecommented, Feb 11, 2020

@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. ❤️

Hopefully, I will be able to find some time to work on this before next week.

2reactions
Mugen87commented, Feb 10, 2020

Agreed, a common approach for Points and Lines is desirable. I think I vote for enhancing Raycaster.params, too. And deprecating Raycaster.linePrecision.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inconsistent raycasting? - Unity Forum
Well in my game you select cubes via clicking and at certain inbetween areas of cubes it's wildly inconsistent, flashing back and forth...
Read more >
Raycast hitting collider of character inconsistently, but hitting ...
I do this using raycasts. I have an issue where the raycast is not always hitting the (huge) box collider I expect it...
Read more >
Raycast Hitbox 4.01: For all your melee needs!
Accurate, performant, and easy to use! Use attachments or vectors to make your hitboxes in seconds! Attachment pairing to create straight-line ...
Read more >
Does anyone have experience with why Physics.RayCast ...
Unity's Physics.RayCast() doesn't seem very reliable when it comes to aiming the ray at ship parts. It works fine for ground terrain or...
Read more >
unity - How to solve the ground check problem?
It's more accurate than raycast: Raycast is a shoot-to-check method, if your raycast shooting is not enough coverage, then it leads to bug ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found