I'm currently working on a feature that requires users to click on two different points and calculate the distance between them.
However, it seems like the clicks are occurring at random positions, resulting in inaccurate calculations.
The calculation works flawlessly when using the OBJ loader with an OBJ file. But if I switch to an STL file using the STL loader, the results are incorrect.
For the code and demo, please visit this CodePen link.
Below is the JavaScript code:
<script type="text/javascript" src="https://dl.dropboxusercontent.com/s/qooungyrgltucai/three.js"></script>
<script type="text/javascript" src="https://dl.dropboxusercontent.com/s/ddt89ncslm4o7ie/Detector.js"></script>
<script type="text/javascript" src="https://dl.dropboxusercontent.com/s/mrhumrr2bxwt9nt/OBJLoader.js"></script>
<script type="text/javascript" src="https://dl.dropboxusercontent.com/s/n5sjyymajykna51/TGALoader.js"></script>
<script type="text/javascript" src="https://dl.dropboxusercontent.com/s/y4r5bmq2037jacg/OrbitControls.js"></script>
<script type="text/javascript" src="https://dl.dropboxusercontent.com/s/h18h48v52739df4/STLLoader.js"></script>
<script>
// JavaScript code goes here
// Including initialization, scene setup, model loading, and measurement logic
</script>