FirstPersonKSP / FreeIva

Work in progress mod for Kerbal Space Program which allows getting out of your seat and moving around the vessel while on IVA.
GNU General Public License v2.0
25 stars 8 forks source link

Boarding from EVA before IVA has been used since scene change breaks the camera #367

Closed embermctillhawk closed 7 months ago

embermctillhawk commented 10 months ago

Here's a doozy, not surprised this wasn't found already because it's some unusual circumstances. Might even be a vanilla bug, actually.

Step 1: acquire a "rescue kerbal in orbit" contract. Tested with Kerbin and Mun orbit contracts. Step 2: rendezvous rescue vessel with distressed kerbal. Tested with both an actual rescue and teleporting a single Hitchhiker container with the cheat menu. Step 3: switch to distressed kerbal, have them EVA, then fly to and board the rescue vessel. Step 4: switch to IVA view, default key C.

The kerbal cannot look around with the mouse. They can unbuckle, they can fly in all 6 directions, they can roll with Q and E, they cannot freelook. It might be a vanilla bug because even without unbuckling they can't freelook, but I don't know for sure.

Probably low priority because it's unusual circumstances and also easily fixed by reloading the scene, but still pretty weird.

JonnyOThan commented 10 months ago

Hi @embermctillhawk ! Please include your ksp.log file with bug reports. I am particularly interested in whether you have 0.2.18.2 or 0.2.18.3 installed, and other mods that might interact with these systems (ThroughTheEyes, ProbeControlRoom, etc.). The log has all of this info.

Well...never mind, I confirmed the repro steps. But in the future, please include that up front, even when you have a solid repro - because often the repro is dependent on a specific set of circumstances you might not be aware of.

embermctillhawk commented 10 months ago

Right, sorry. Also, tested, doesn't happen in vanilla. I can reproduce it with just FreeIVA, ModuleManager, and KER, made a new ksp instance for that.

Freeiva version is 2.18.3

Further testing, it does happen with just FreeIVA and ModuleManager.

Found another workaround for the issue besides scene reload; Step 1: same as above Step 2: same as above Step 3: switch to the distressed kerbal, IVA and look around, then EVA and board the rescue vessel Step 4: switch to IVA view and note that the kerbal can still look around with the mouse

JonnyOThan commented 10 months ago

Sweet, I figured out what's going wrong and I suspected that this bug would only occur if you had NEVER been in IVA mode since the last scene change before boarding a vessel from EVA. Seems like you've confirmed that.

It sort of is a stock issue, in that one of the InternalCamera fields doesn't get initialized properly if it doesn't go through certain code paths - but it would only do this because of how FreeIva is using it.

Going to need a lot more testing on the fix though.

https://github.com/pizzaoverhead/FreeIva/blob/e9526560b83ab39d6b170f6c29f96c4de6414745/FreeIva/KerbalIvaAddon.cs#L599C20-L599C20 The false parameter here means that we do not call InternalCamera.ResetCamera, which leaves the initialRotation quaternion member at a completely invalid 0,0,0,0. This value is then used later in rotation calculations, which is why you can't turn once you're in this state. This call was changed from true to false a while ago, but I can't remember why and the commit message doesn't explain it either. I think it looks mostly safe to change this, except I definitely need to test switching kerbals in VR first. However while trying to investigate that I stumbled across another weird bug...