KSPModdingLibs / KSPCommunityFixes

Community patches for bugs in the KSP codebase
49 stars 17 forks source link

CollisionManagerFastUpdate patch breaks KerbalVR #222

Open gotmachine opened 4 months ago

gotmachine commented 4 months ago

KerbalVR is sometimes parenting a controller object with colliders (the "hands") to parts.

To avoid the stock CollisionManager from disabling interactions between the rest of the vessel and those custom colliders, KerbalVr implements a prefix/postfix harmony patch around the CollisionManager.GetAllVesselColliders() private method, temporarily un-parenting the controller object : https://github.com/JonnyOThan/Kerbal-VR/blob/68aa41f8461447adfb4f3e7984fbf600a5858293/KerbalVR_Mod/KerbalVR/KerbalVR_InteractionSystem.cs#L134-L154

With the CollisionManagerFastUpdate patch, the GetAllVesselColliders() method isn't called anymore, resulting in the KerbalVR patch not being called either.

If a solution can't be found or is too unpractical on the KerbalVR side, a workaround on the KSPCF side could be to replace the body of the GetAllVesselColliders() method with a transpiler, making it return null but calling the KSPCF version, and passing around the results in a static field.

See https://github.com/JonnyOThan/Kerbal-VR/issues/322