Closed ZetaVivern closed 1 year ago
I have had a similar problem. Zooming in too far results in camera lock. BeplnEx LogOutput.log reads:
[Error :Il2CppInterop] During invoking native->managed trampoline
Exception: System.ArgumentNullException: Value cannot be null. (Parameter 'key')
at System.Collections.Generic.Dictionary2.FindValue(TKey key) at System.Collections.Generic.Dictionary
2.ContainsKey(TKey key)
at ModernCamera.Behaviours.FirstPersonCameraBehaviour.UpdateCameraInputs(TopdownCameraState& state, TopdownCamera& data)
at ModernCamera.Hooks.TopdownCameraSystem_Hook.UpdateCameraInputsHook(IntPtr _this, TopdownCameraState& cameraState, TopdownCamera& cameraData)
at Il2CppInterop.Runtime.IL2CPP.il2cpp_runtime_invoke(IntPtr method, IntPtr obj, Void* param, IntPtr& exc)
at DMD
It looks like ModernCameraState.ShapeshiftName has a null value in some instances.
Possible fix in 1.5.4
Thanks for the swift turnaround. However, this did not fix the issue for me. The last I looked at anything C-like was about a decade ago, so I'm no expert, but I have a hypothesis. I think that ModernCameraState.ShapeshiftName is declared but not initialized upon startup for some reason. This may be the root cause of issue #10 as well.
If I start up the game and login to my dedicated server (hosted on another computer) and zoom in, I get the error. If I start up the game and login to a single player world and zoom in, I do not get the error. If I start up the game and login to my dedicated server, hit the escape key and hit the leave game button, then log back into my dedicated server and zoom in, I do not get the error.
When I leave my dedicated server, this calls ModernCameraState.reset(), which initializes ModernCameraState.ShapeshiftName to "".
I'm just spitballing here, but it might have an origin in ModernCamera.cs at line 84 with WorldUtils.ClientWorldExists. If this is specific to a client hosted world, then perhaps UpdateSystems() never gets called?
How are you reproducing this issue? Because I've never been able to get it to happen. I can zoom in and out, including first person, and never have an issue.
Ok, after testing a bunch, I think I know how you can reproduce the issue.
Try to login to your dedicated server through direct connect instead of selecting the server from a list.
I believe the issue was caused by not having the current object for game systems due to the world being destroyed and recreated after leaving a game and joining a new one. ModernCamera was still holding onto the old objects and therefore not getting the newly created systems.
Mind testing the pre-release https://github.com/v-rising/ModernCamera/releases/download/ModernCamera-v1.5.5-pre/ModernCamera.zip ?
Good news! Upon installation of 1.5.5, I was unable to reproduce the issue!
However, I wanted to do additional testing and reverted to 1.5.4 to try to reproduce the issue again (I wanted to make sure I wasn't confounding with all the server setting changes I did trying to figure out workarounds that could help you reproduce the issue). I could not reproduce the issue after reverting to 1.5.4. I'm not sure what this means, or if it means anything to you.
Well done though. You work fast and well.
Hopefull it's fixed for good. Going to close this a release 1.5.5.
Was zooming in close with action camera while inside a tent, resulted in the camera being locked looking in a specific direction without turning, changing between normal and action camera didn't help. Probably the reason was some combination of the zoom and the confined space.