Skip to content Skip to sidebar Skip to footer

Three Js - Strange Raycast Behaviour When Objects Are Moved

Version and info THREE.ObjectLoader2: 2.4.1 THREE.LoaderSupport.MeshBuilder: 1.2.1 THREE.LoaderSupport.WorkerSupport: 2.2.0 THREE.WebGLRenderer: 93 THREE.REVISION: 93 The problem

Solution 1:

I think that your model might not have proper bounding boxes/spheres generated. The circular shape could result from the rays passing the bounding sphere check of a bounding sphere that is too small.

You mention resizing/processing your geometries in some way... After you do that, try calling geometry.computeBoundingBox() and geometry.computeBoundingSphere() to rebuild boxes and spheres, and see if that helps?

edit: Apparently this problem was due to bounding boxes and spheres not being recomputed...

the fix was to:

scene.traverse( (o)=>if(o.geometry){o.geometry.computeBoundingBox();o.geometry.computeBoundingSphere();} );

Post a Comment for "Three Js - Strange Raycast Behaviour When Objects Are Moved"