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

Conversion world coordinates <-> object3D coordinates #1022

Closed
scrubs opened this issue Jan 5, 2012 · 3 comments
Closed

Conversion world coordinates <-> object3D coordinates #1022

scrubs opened this issue Jan 5, 2012 · 3 comments
Labels

Comments

@scrubs
Copy link

scrubs commented Jan 5, 2012

Hello,

What I don't manage to do is to determine the world coordinates (position & rotation) of an object3D which can be the child of multiple other object3Ds.

In my application, I have assemblies and subassemblies including 3D models that can be translated and rotated. The position and rotation values of the object3Ds are relative to the parent, but I'd also like to be able to display the absolute values of those object3Ds.

When only translations of the parents are involved it is pretty easy to define the absolute values as it is just a shift for the position but it is when rotations are also included that I'm kinda lost!

Thanks for your time.

@alteredq
Copy link
Contributor

alteredq commented Jan 5, 2012

var worldPosition = object.matrixWorld.getPosition();

@mrdoob mrdoob closed this as completed Jan 10, 2012
@greengiant83
Copy link

This GETS world position of an object. How do you SET world position of an object?

@greengiant83
Copy link

(Updating since this still comes up in google results)
The above technique is deprecated

var worldPosition = new THREE.Vector3().setFromMatrixPosition(object.matrixWorld);

or

var worldPosition = new THREE.Vector3();
object.localToWorld(worldPosition);

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