【问题标题】:three.js how to change axis position of a cube三.js如何改变立方体的轴位置
【发布时间】:2017-04-07 07:51:00
【问题描述】:

我目前正在使用three.js(体素画家)进行一个项目。当我更改立方体的大小时遇到​​一个问题,xyz 轴保持在立方体的中心并且没有放置在立方体的最左侧,当它被放置在网格上时,立方体会发生偏移

   cubegeo= new THREE.BoxGeometry(100, 50, 70)

我想要什么

默认在three.js上

【问题讨论】:

    标签: javascript three.js voxel


    【解决方案1】:

    您可以将矩阵应用于立方体:

    cubegeo.applyMatrix( new THREE.Matrix4().makeTranslation(cubeWidth/2, cubeHeight/2, cubeLength/2) );
    

    【讨论】:

    • 现在首选:cubegeo.translate( cubeWidth / 2, cubeHeight / 2, cubeLength / 2 );
    猜你喜欢
    • 1970-01-01
    • 2012-09-14
    • 2019-01-10
    • 2017-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-02
    相关资源
    最近更新 更多