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

Editor: Add center option. #21340

Merged
merged 1 commit into from
Feb 23, 2021
Merged

Editor: Add center option. #21340

merged 1 commit into from
Feb 23, 2021

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Feb 23, 2021

Related issue: -

Description

This PR adds a center option in the Edit menu bar in the editor. It makes it possible to center objects which is useful for debugging models.

@mrdoob mrdoob added this to the r126 milestone Feb 23, 2021
@mrdoob mrdoob merged commit b34af46 into mrdoob:dev Feb 23, 2021
@mrdoob
Copy link
Owner

mrdoob commented Feb 23, 2021

Thanks!

@mrdoob
Copy link
Owner

mrdoob commented Feb 16, 2024

I'm doing some clean up in the editor menu...

I forgot, what does this exactly center?

If I add a TorusKnot to the scene and I do edit/center it moves it to the left.
If I do edit/center again it moves it to the left again... 🤔

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Feb 16, 2024

Sometimes the geometry data of meshes have an offset. So even if the position says (0,0,0), the mesh isn't located at the origin. The logic I have added at that time was from Don's glTF viewer which is executed once after the load of an glTF asset.

I think the issue in the editor can be fixed by rewriting the code to:

newPosition.x = object.position.x - center.x;
newPosition.y = object.position.y - center.y;
newPosition.z = object.position.z - center.z;

/cc @donmccurdy

@donmccurdy
Copy link
Collaborator

That's cleaner yes, thanks! Fixed donmccurdy/three-gltf-viewer@202edc1.

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

Successfully merging this pull request may close these issues.

3 participants