有什么办法可以纠正这种失真? 三个JS

问题描述

xhr.open("GET",'./assets/montagem-final.stl',true);
xhr.responseType = "arraybuffer";
xhr.send(null);

我正在尝试学习Three.js的一点...我有以下代码

https://codesandbox.io/s/icy-currying-lgp1e

我应该实现这样的目标:

image containing what I would like to accomplish

然后:

positions of this .stl object added to the scene should be read,to add new objects to it (buttons / cylinders) that are not sensitive to zoom,and when clicked they show a text from the xml file

我正在尝试遵循此示例中显示内容https://jsfiddle.net/prisoner849/0x1besz7/

但是我不能走太远...我认为它没有正确加载STL文件...

我已经尝试过:(我无法完成这项工作)

let marker = new THREE.Mesh(new THREE.CylinderBufferGeometry(0.25,0.25,0.5,16),new THREE.MeshBasicMaterial({ color: "yellow" }));
marker.geometry.translate(0,0);
marker.position.set(0,5,0);
scene.add(marker);

let scaleVector = new THREE.Vector3();
let scaleFactor = 10;

renderer.setAnimationLoop(() => {
    let scale = scaleVector.subVectors(camera.position,marker.position).length() / scaleFactor;
    marker.scale.setScalar(scale);
    window.addEventListener("click",getClicked3DPoint);
    renderer.render(scene,camera);
})

//这应该将我的.stl对象添加到场景中,然后在其上放置一个圆柱体...

if( $tolal >= 400 )

由此,我放置的圆柱体中会出现变形。 (我阅读了它们,并根据阅读的内容对其进行了定位,但是它们会旋转,并且不固定在应该放置的位置。)

任何帮助都将非常欢迎,或表示材料。预先感谢您的关注和帮助。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)