Quentin Grisard
Quentin Grisard

Reputation: 21

three.js how to change axis position of a cube

I am currently working on a project with three.js (voxel painter). I encounter a problem when I change the size of a cube the xyz axis remains centered on the cube and does not place at the extreme left of the cube, which gets a shift of the cube when it is placed on the grid

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

What I want

enter image description here

By default on three.js

enter image description here

Upvotes: 0

Views: 1062

Answers (1)

mzymta
mzymta

Reputation: 11

You can apply matrix to the cubegeo:

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

Upvotes: 1

Related Questions