Hello!
I made the model using Blender. If I use mesh.rotation.y - it rotates, but around the one fixed point (axis). If I move the object (mesh.position.x) - it moves, but the rotation axis stay in the same place relative to the object.
How can I select the rotation axis position?
//Sorry for my English. I'm not a native English speaker
You can do it this way... say you want the axis position be at ( -100, 0, 0 ):
var dummy = new THREE.Object3D();
var your_object = new THREE.Mesh( geometry, material );
your_object.position.x = 100;
dummy.addChild( your_object );
scene.addObject( dummy );
Thanks! That was very helpful
When I try this
var dummy = new THREE.Object3D();
var your_object = new THREE.Mesh( geometry, material );
your_object.position.x = 100;
dummy.addChild( your_object );
scene.addObject( dummy );
It show "Uncaught TypeError: dummy.addChild is not a function at
addChild()
and addObject()
were renamed long ago to just add()
.
@merbin2012 You can instead translate the geometry: geometry.translate( x, y, z ).
See this stackoverflow answer.