admin管理员组文章数量:1295953
so i've made made an update on my GLB files
As you can see this is my chair in blender
And these are the child nodes that make up the figure of the chair
As you can see its only an one child node
But this happens, when i setup raycaster to select one object of my scene and paint it random colour
it doesnt paints the entire chair, it paints a part of the chair like if were more nodes to paint, i dont know
fun fact: in the past that was possible because the chair in blender was divided into various nodes, but i unified them, and overwrited the old .glb file. but it still happening like if it was reading an old .glb file. I restarted my project, and it doesnt worked
this is my raycaster code:
const raycaster = new three.Raycaster()
document.addEventListener('mousedown', onMouseDown)
function onMouseDown(event){
const coords = new three.Vector2(
(event.clientX / renderer.domElement.clientWidth) * 2 -1,
-((event.clientY / renderer.domElement.clientHeight) * 2 -1)
)
raycaster.setFromCamera(coords, camera)
const intersects = raycaster.intersectObjects(scene.children, true)
if(intersects.length > 0){
const selectedObject = intersects[0].object
const color = new three.Color(Math.random(), Math.random(), Math.random())
selectedObject.material.color = color
console.log(`${selectedObject.name}`)
}
}
本文标签: javascriptThreeJS Raycaster selecting oldwrong nodesStack Overflow
版权声明:本文标题:javascript - ThreeJS: Raycaster selecting old, wrong nodes - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741625238a2389042.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论