I am trying to change the value for a lights contact shadow length during gameplay… reason is that I have an isometric view with zoom, and all the length values show artefacts at some point when you zoom in… basically there is a different optimal value for each zoom level.
My solution for that would have been to set the contact shadow length value of all lights in the level with contact shadows enabled to a different value as the player zooms in or out, so the contact shadows would always look as good as possible with as little artefacting as possible.
But while I got the basic code to work, it seems like assigning a new value to the lights is doing nothing… the lights seem stuck with the initial value set in the editor before hitting play. Any idea what I could try else?
Here is the current code (results of some minutes of mad hacking by a C++ noob, so don’t cruzify me for any follishness… critique on how to write better code always welcome though):
for (ALight* light : lightArray) {
(*light).GetLightComponent()->ContactShadowLength = FMath::Abs(foundComp->GetRelativeTransform().GetLocation().X) / 9333.0f;
}
Camera zoom works by moving the camera closer to the ground… that is why I use the X axis for that. Probably not the best solution.