I need to make a few adjustments to camera and lighting settings depending on whether the player is indoors or outdoors, but my game is seamless with no doors or loading areas where I can hardcode the transition. The best solution I’ve thought up is to put a function on a 1-second timer, and each time it triggers run a raytrace straight above the player’s head to see if they’re standing under a roof. The problem with doing it this way is that it’s important that the camera never goes into indoors mode while outdoors, as one of the things the transition does is turn off the sun and skylight, so they don’t interfere with indoor lights, and lots of things (like walking under a bridge, or standing in a doorway) could trigger the indoor transition while you can still see the sun. Is there a more foolproof way of accomplishing what I’m proposing?
There is an easier solution … add a series of volumes to your rooms or buildings and have events trigger on the character entering and exiting those volumes. This will be far more efficient and would be the way that I would tackle this problem.
Hmm, that’s much simpler… is there an appreciable performance difference between putting giant, building-sized volumes in the persistent level compared to small door-sized ones? The former would have fewer edge cases, as I could just set on/off in actorbegin/actorend overlap, but it would ultimately mean adding hundreds of volumes exclusively for this piece of functionality.
Well the volumes are not rendered so there should be no performance hit there, but some experimentation would be required. If you can get away with one larger volume than that is obviously better.
The other choice is a volume on the outside of the door that is triggered when you enter and sets a flag on your player to say they are walking in and another volume on the inside of the door that sets a flag on your player saying they are walking out. It could be one boolean flag like “isIndoors” and you can use the same principle as above, without having to create these huge volumes or excessive volumes.
This would probably be the best solution for you in this instance.
Hmm, if the player was walking indoors in your example, they would hit the volume that sets isIndoors=true while walking in, but why wouldn’t they immediately run into the volume on the other side of the door intended to go off when they left? Wouldn’t they have to traverse both volumes regardless of whether they’re entering or leaving?
Oh … yeah so you would reverse the volumes. So the volume on the outside sets the flag for being outdoors and the volume in the inside sets the flag for being indoors. So they are already outdoors and their flag “isIndoors” is false … they walk through the volume on the outside and nothing will happen but when they hit the volume on the inside it will set the flag to “isIndoors” and you can trigger your effect.
The reverse would be true for the flag if they went the other direct. Ideally the volumes will be close together but should probably remain separate volumes. I wish I had access to my dev machine so I could do a quick prototype for you and maybe visually explain what I mean.
It is important to note that you don’t really need the flag, but I would keep the flag as it could become useful for other events that you might want to trigger.
This is super-helpful, thank you very much for the advice!
Cool man … I am glad I could help. Good luck with your project. 8-}
Yea, I got the two-volume version working, it does give much finer-grained control than using a single volume with begin/end overlap events, thank you again for the suggestion!
Another way would be to send a ray from straight above with a given interval, and if it does not hit geometry but the player, but that would mean that you could be “indoors” under a tree or a umbrella.