I have a scope mostly working by using a cutscene to change the FOV, and making the camera move along with the player. There are two technical problems, though:
1. Sector properties are not updated when moving from one sector to another (e.g., fog color and distance don't change when entering/exiting a cave). This one's not so bad, since players are unlikely to move too far while scoped anyway. I could also disable the scope if you move too far, if I really wanted to minimize the issue.
2. Level geometry occlusion doesn't always update. So, for example, if you zoom in, then walk around a corner, any level geometry that was originally blocked will still not be rendered (
screenshot). I think I've only seen this happen on level 5 (even the corridors of level 8 seem fine), but it's a pretty big error to expect players to just re-scope and ignore.
Currently, as a workaround, I have it so you can't move while zoomed in. If you try, it just deactivates the scope. This isn't
terrible, but it's kinda clunky and feels like a lame compromise.
Anyone have any idea if there's some "proper" way to update the camera so sector properties and level occlusion actually get updated? Here's how I'm doing it currently:
when activating the scope:
Camera.StartCinematic( CMF_NO_LETTERBOX | CMF_SHOW_HIDDEN_OBJECTS | CMF_NO_INITIAL_FADEOUT );
// at least one of these allows camera position to be updated in OnTick() after key acquisition cutscene
Camera.ClearLookAtActor();
Camera.ClearFinalView();
Camera.ClearViewTracks();
in OnTick(), while scope is active:
kStr s;
if ( Sys.GetCvarValue("r_fov",s) )
Camera.fov = s.Atof() / ScopeMag;
kPuppet @owner = self.Owner().Actor();
// update camera orientation
Camera.origin = EyePos();
Camera.pitch = owner.Pitch();
Camera.roll = owner.Roll();
Camera.yaw = owner.Yaw();
I tried using Camera.SetEyeView() to see if it would more robustly update the camera's position, but it did nothing on its own, and fixed neither issue when used in conjunction with setting Camera.origin. I've also messed with some other camera functions, but haven't been able to get them to even do anything. :/