maxbit89 maxbit89 - 10 months ago 144
Javascript Question

WebGL/Three.js set mesh offset

I have a question about

How do I set an offset to a mesh?
The basic code is available at:

What I want is to set a position offset and also that point should be used as the rotation reference.

I tried:
mesh.applyMatrix( new THREE.Matrix4().makeTranslation( -2, 0, 0 ) );
but this only moves the mesh in the scene.


You can simply do:

var group = new THREE.Group();
scene.add( group );

var mesh = new THREE.Mesh( ..., ... );
mesh.position.set( -2, 0, 0 );
group.add( mesh );