I created an terrain but i am not able to use the raycasting on it means i am not able to get that as an intersect , i need help on this . Please three js team share your views.
Checked the attached file that contain the terrain dxf-import.html (283.9 KB)
I’ve imported your code in a fiddle to debug it: https://jsfiddle.net/0kqtrb3s/4/
The problem is that you recompute the
position attribute but you don’t recompute the bounding volumes of the geometry. That means the bounding volumes have a very large scale and thus won’t detect the intersections. Doing the following after recomputing
position should solve your issue:
terrainMesh.geometry.attributes.position = newPositionAttribute;
terrainMesh.geometry.computeBoundingBox(); // FIX
terrainMesh.geometry.computeBoundingSphere(); // FIX
@mugen and rest three js respected team
As i read an article that both bounding box and sphere is playing a role in obj detection
In my recent work on terrain @mugen your solution is working fine when i create the terrain than i am saving the terrain point in the DB to the flow value is truncated (like 0.001122345 to 0.001123) and i am using these points to create the terrain again what is see the position is little bit changed and also due to this the bbox and bounding sphere too and than the raycasting again not working please i need an immediate suggestion on this i attached the before and after screen shot so you guzs can debug and help me.
In before screen shot ray casting is working and in after it is not
Here i also read normal plays a role in lighting so does it also related to raycasting because after reload the normal is also not same as before