Shadows don't update when I use SET_CLOCK_TIME, am I missing something?
-
In my Auto-Snap mod, I have the ability to set the time to a specific value. Although the sun moves, the shadows don't, unless I change from one preset to another. Setting the time via my menu option, uses the exact same function call as it does when it switches presets, so I can't understand why one changes the shadows and the other doesn't.
I am using this
Function.Call(Hash.SET_CLOCK_TIME, hour, minute, seconds
but I have also tried thisFunction.Call(Hash.ADVANCE_CLOCK_TIME_TO, hour, minute, seconds
with the same effect.I have a feeling it's something really obvious that I am missing, I just can't see anything in the NativeDB that seems like the solution. Simple Trainer does exactly what I need to do, so it has to be my code... no surprise there.
Edit: I have just been watching my game in a preset for a short while after changing the time and the shadows do eventually change but it's almost like it only does it every game hour or something. Maybe I am just using the wrong native.
-
Hmmm, this is actually worse than I thought and I have my suspicions about what might be causing it.
Simple Trainer uses the normal gameplay camera, my mod uses my own custom camera. I wonder if the environment updates work differently through different camera types.
The disturbing thing I have just discovered, is that not only do the shadows not change when I change the time, they also don't actually change either when I change presets, or when I am in playback mode. So that renders the whole time side of my mod completely redundant with regards to shadows.
-
Okay... so that's confirmed. If I don't change to my custom camera, time and shadows update as normal. If I do change to my custom camera, shadows only update after a
fixedvariable period of time... crap.
-
Well the semi-good news is that I can get this to work during playback mode in my mod, by switching my custom camera off when the screen is faded out, setting the clock time, then switching back into my custom camera before the screen fades back in. This updates the time of day while the normal camera is active, so the shadows update properly.
The bad thing is that I cannot find a way to do this in the setup mode, because it seems to require a single frame update to change the shadows, which causes a visible glitch as cameras change back and forth. But at least it works in playback mode and that's where it is more important.
So unless someone else has anything to add, I'll mark this as the answer and consider this solved, albeit unsatisfactorily.
-
Jeez, what a mess... Skydome gets desynced when you attempt to alter timeflow which is unfixable by any means, and now this. First game where I've seen something like that. Why coders had to do such a weird job at it is a mystery.
-
@Forrest-Gimp It's so erratic as well with the updating. One time it might take just a few seconds to update, next time it could take close to a minute. I can only presume that they thought the non-gameplay cameras didn't need to update everything like the normal gameplay camera.
It still could be a case of me doing something wrong but the fact that the problem doesn't exist with the normal gameplay camera, does make it seem like it is by design. Perhaps it is to reduce processing overhead in the camera views that are intended for close-ups and cut-scenes... not sure really, it's just speculation.