Hi,
We are getting some problems after parenting and unparenting a directional light to a camera. In this playground I’ve reproduced the issue:
It seems that after parenting and unparenting the light, the shadow is not being calculated properly. Also notice that light.shadowMinZ and light.shadowMaxZ are changed after unparenting the light.
Is there a way to recalculate the original shadow after unparenting the light?
Thanks
You will need to reset the light.transformedDirection to null (as well as transformedPosition even if this one is not strictly necessary for your PG to work) after you unparent to make it work because ShadowLight.getShadowDirection is returning transformedDirection if it is not null, which is wrong when the light has been unparented:
I guess resetting transformedDirection / transformedPosition should be done automatically by the light class at some point… Maybe in ShadowLight.computeTransformedInformation? Overriding the Node.parent setter does not seem a good idea as it is doing a lot of things that would need to be rewritten as we can’t call a base setter from an overriden setter. I will let @Deltakosh / @sebavan have a look at that one.