简体   繁体   中英

WebGL/Three.js set mesh offset

I have a question about three.js . How do I set an offset to a mesh? The basic code is available at: http://lukas.achatz.ws/tst/webgl_003.html

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 );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM