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

Improve docs of addChild() and setParent() #16073

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

nene
Copy link
Contributor

@nene nene commented Jan 16, 2025

I struggled a lot with using addChild(). It seemed to mess up the position of the child mesh. I had no idea why, because the documentation only said:

Adds the passed mesh as a child to the current mesh

It also wasn't clear to me what's the relationship between just assigning to .parent or calling setParent().

After struggling with these problems for many weeks, I finally read the source and figured out that addChild() simply calls setParent(), the documentation of which does say what it does with child coordinates.

I'd hope this little improvement to the docs will help others to better understand the relationship between these three ways of setting the parent.

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 16, 2025

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@nene
Copy link
Contributor Author

nene commented Jan 16, 2025

Sorry @bjsplat, I think I don't have a permission to assign labels.

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 16, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 16, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 16, 2025

@RaananW RaananW merged commit 4c88fbd into BabylonJS:master Jan 16, 2025
14 checks passed
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