Comments (1)
A clear and concise example how to use this, and even more how to use raycasting to get intersected objects. For example what im trying to do is, simply get the index of clicked object.
There's nothing different that has to be done for instanced mesh. You can access the intersected instance the same way you can with the native three.js raycast functionality:
const hit = raycaster.intersectObjects( scene.children )[ 0 ] || null;
if ( hit ) {
// the instance id of
console.log( hit.instanceId );
}
Here's a jsfiddle showing how:
https://jsfiddle.net/87e95yzx/7/
Is that what you're looking for?
Even when using the mesh.geometry.computeBoundsTree();, my bounds tree looks like this which seem incorrect...
The BVH is only generated for the single geometry and reused, and the helper is positioned at the origin of the passed in InstancedMesh. No BVH is generated for the set of instances at the moment. Perhaps it would be more clear to show the helper at the position of the first element in the InstancedMesh?
from three-mesh-bvh.
Related Issues (20)
- a syntex error in index.js when import from 'three-mesh-bvh' HOT 1
- ./node_modules/three-mesh-bvh/src/index.js Module parse failed: Unexpected token (12:9) HOT 1
- Error when calculating bounding box of group which includes `MeshBVHHelper` as child
- InstancedMesh regression in 0.7.5 HOT 7
- Not able to find any *.generated and *_indirect js files in your repository HOT 2
- Update ESLint, typescript dependencies
- [Question] Collision effect using BVH Shapecast HOT 2
- getBoundingBox box very slightly bigger than threejs bounding box HOT 3
- please update you clippedEdges example, it doesn't work HOT 1
- TS type augmentations don't work w/ "moduleResolution": "node16" HOT 3
- [Question] Make collision smoother HOT 1
- Raycast missing the bottom edge of a face randomly, likely based on floating point rounding HOT 4
- Should there be otherRoots[j] instead of otherRoots[i] in function bvhcast () ? HOT 3
- Alternate construction techniques to review
- How to use in a large number of point clouds HOT 1
- Examples: Fix lighting in examples from version update HOT 1
- BVHShaderGLSL is not available for typescript HOT 2
- ClosestPointToPoint: Optimization by keeping stack sorted by distance #715
- Update MeshBVHHelper to display BatchedMesh, InstancedMesh BVHs
- ClosestPointToPoint: Signed Distance HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from three-mesh-bvh.