Fix light helpers: change `updateMatrixWorld()` to `updateWorldMatrix()`
See original GitHub issueContinuing the spirit of fixing issues like #19962 (see PR https://github.com/mrdoob/three.js/pull/19969 and https://github.com/mrdoob/three.js/pull/20224 as example fixes), we need to update these lines:
- https://github.com/mrdoob/three.js/blob/0b608ec69ab413eb17eb9b93a2e780e9ab072f53/src/helpers/DirectionalLightHelper.js#L18
- https://github.com/mrdoob/three.js/blob/0b608ec69ab413eb17eb9b93a2e780e9ab072f53/src/helpers/HemisphereLightHelper.js#L19
- https://github.com/mrdoob/three.js/blob/0b608ec69ab413eb17eb9b93a2e780e9ab072f53/src/helpers/SpotLightHelper.js#L16
- https://github.com/mrdoob/three.js/blob/0b608ec69ab413eb17eb9b93a2e780e9ab072f53/src/helpers/PointLightHelper.js#L15
AS A BONUS: There are a two related issues to fix:
- Remove this line … because it is already done in the constructor.
- For both
DirectionalLightHelper
andSpotLightHelper
, we need to dothis.light.target.updateWorldMatrix(true, false)
… because currentlythis.light
is updated but notthis.light.target
, so you get a bug because the helper shows the wrong direction for these lights (this happens in my app – I have a runtime patch right now to fix this bug).
If this all sounds good to the maintainers, I will send a PR. Let me know.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Object3D.getWorld*() should call updateWorldMatrix(true) ...
When we call Object3D.getWorld*(), we want object.parent.matrixWorld to be updated, but not it's children. is this a bug?
Read more >Object3D#updateMatrixWorld
Object3D. This is the base class for most objects in three.js and provides a set of properties and methods for manipulating objects in...
Read more >object.updateWorldMatrix is not a function - three.js
As documentation of Three.js said, after changing the position of the camera, we must call the updateProjectionMatrix() method.
Read more >Developing with three.js
js provides helpers to make them easier. Local to World Transforms. Normally, we'd need to call .updateMatrixWorld () on parent Object3D s, but...
Read more >Three.js Aligning HTML Elements to 3D
function render() { · renderRequested = false; · if (resizeRendererToDisplaySize(renderer)) { · const canvas = renderer.domElement; · camera.aspect = canvas.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m closing this (again) and will instead contribute to the discussion @Mugen87 linked above (https://github.com/mrdoob/three.js/pull/21427).
Related #21427.