Add overload from the docs to MeshBVHHelper type #729
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was trying to construct a
MeshBVHHelper
via aMeshBVH
that i constructed viaBufferGeometry
not aMesh
. The type doesn't support the overload thats listed in the docs.With this change, i seem to be able to pass these three arguments without TS complaining and i see the results. I'm also confused with the default parameters of
null
since the type doesnt seem to be nullable. This makes it sound like itsmesh?: THREE.Mesh | null
.However, if i try to construct this with
MeshBVH
instead ofTHREE.Mesh
I run into an issue here:
Because of this i believe:
three-mesh-bvh/src/objects/MeshBVHHelper.js
Line 239 in 8f642cb
If you provide
MeshBVH
instead, it will setthis.mesh = null
and then accessing a property on it fails.I couldn't dig deeper into this at this point. The quickest thing may be to remove the
Mesh|BVHMesh
from the first argument in that signature and update the docs accordingly.