-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
Object3D: Fix world matrix update bug in .attach() #20759
Conversation
No |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that object.add()
does not update the world matrices. So is that a 'bug', too?
I think this PR is an improvement, in any event.
Yeah, Anyways,
I think so too. Calculating the world matrix as the object is under an old parent doesn't make sense. |
I replaced Another option is cutting off What is the original purpose of calling it in |
Thanks! |
Description
This PR fixes a bug of world matrix update in
Object3D.attach()
and adds a unit testCurrently
Object3D.attach()
moves an object to under a new parent while keeping its world matrix values by doing the following.Object3D.updateWorldMatrix()
But
Object3D.updateWorldMatrix()
should be called after adding an object to the new parent. Otherwise, the object's world matrix will be wrong because the world matrix is calculated as the object is under the old parent.This PR moves
Object3D.updateWorldMatrix()
after the line adding an object to the new parent.You can check this change works by using the unit test this PR adds. Without the change in
Object3D.attach()
the test fails while with the change the test passes.