Three.js: Proper way to add and remove child objects using THREE.SceneUtils.attach/detach functions

前端 未结 3 1738
無奈伤痛
無奈伤痛 2021-01-01 00:37

Using three.js, and adapting instructions from West Langley\'s post provided here: Three.js: Adding and Removing Children of Rotated Objects, I set up a WebGL scene to whic

3条回答
  •  心在旅途
    2021-01-01 01:12

    SceneUtils.attach/detach has been deprecated since r105 . One should use Object3D's attach() method directly

    // parent the cube to parentCube
    parentCube.attach(cubeMesh[i]);
    
    // parent it to the scene
    scene.attach(cubeMesh[i])
    

    Remark : detach() doesn't exist anymore

    three.js r.123

提交回复
热议问题