Skip to content

Editor: Add center option.#21340

Merged
mrdoob merged 1 commit into
mrdoob:devfrom
Mugen87:dev48
Feb 23, 2021
Merged

Editor: Add center option.#21340
mrdoob merged 1 commit into
mrdoob:devfrom
Mugen87:dev48

Conversation

@Mugen87
Copy link
Copy Markdown
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
Copy Markdown
Owner

mrdoob commented Feb 23, 2021

Thanks!

@mrdoob
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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