pnext / three-loader

Point cloud loader for ThreeJS, based on the core parts of Potree
Other
201 stars 88 forks source link

Overriding updateMatrixWorld() leads to issues #70

Open rhuitl opened 4 years ago

rhuitl commented 4 years ago

The method Object3d.updateMatrixWorld()(https://github.com/mrdoob/three.js/blob/400acd3c78c8e631087322eb1e0e9fc00a16b375/src/core/Object3D.js#L560) is overridden in https://github.com/pnext/three-loader/blob/7db6366e4f8ac716c9d1a375c30cd418fca50b78/src/point-cloud-octree.ts#L160 with a method that does not recurse into the children.

Can anyone clarify why this is done? Doesn't that break things when the world matrices of the child nodes should be updated, e.g. after changing the model matrix of the whole point cloud?

For me it does break things, it looks like most parts of the point cloud move to the new position but some points are left behind. I'm calling updateMatrixWorld(true) on the point cloud object. Inspecting the child nodes, I see that their matrixWorld has not been updated.

When I use the related method updateWorldMatrix(false, true) instead (https://github.com/mrdoob/three.js/blob/400acd3c78c8e631087322eb1e0e9fc00a16b375/src/core/Object3D.js#L594), which is not overridden, my code works as expected.