Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to select the point of object rotation? #405

Closed
savalin opened this issue Aug 5, 2011 · 5 comments
Closed

How to select the point of object rotation? #405

savalin opened this issue Aug 5, 2011 · 5 comments
Labels

Comments

@savalin
Copy link

savalin commented Aug 5, 2011

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

@mrdoob
Copy link
Owner

mrdoob commented Aug 5, 2011

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

@savalin
Copy link
Author

savalin commented Aug 5, 2011

Thanks! That was very helpful

@savalin savalin closed this as completed Aug 5, 2011
@merbin2012
Copy link

merbin2012 commented Feb 28, 2017

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 :4:11" this error

@mrdoob
Copy link
Owner

mrdoob commented Feb 28, 2017

addChild() and addObject() were renamed long ago to just add().

@WestLangley
Copy link
Collaborator

@merbin2012 You can instead translate the geometry: geometry.translate( x, y, z ).

See this stackoverflow answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants