Folding rectangles to form a cube using three.js

前端 未结 1 1798
别那么骄傲
别那么骄傲 2020-12-19 04:46

I am trying to make a cube with given 6 faces lying on the surface as a cube net with one face movable. Something like this:

In the above picture, there are

相关标签:
1条回答
  • 2020-12-19 04:59

    You can use hierarchy of objects.

    var obj1 = new THREE.Mesh(...);
    var obj2 = new THREE.Mesh(...);
    obj1.add(obj2);
    

    There's a good example of it.

    So, using this principle, I made animation for folding the cube, given in your question. Of course, this is not the ultimate solution, this is just a starting point.

    jsfiddle example

    upd: I've updated the fiddle. You can start folding by clicking the PressMe button. Animation made with Tween.js (see the foldTheCube() function)

    0 讨论(0)
提交回复
热议问题