KSPModdingLibs / KSPCommunityFixes

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

Kerbal standing still on a part (on landed vessel) moves forward a bit every x seconds #202

Open kurgut opened 6 months ago

kurgut commented 6 months ago

Whenever a Kerbal is standing still on a part, which is part of a landed vessel, he will repeatedly move forward a little every x seconds, which is for instance very annoying for filming shots involving those situations, since you can't get the Kerbal to stay steady for more than 5-ish seconds... Example video attached. Thank you : )

https://github.com/KSPModdingLibs/KSPCommunityFixes/assets/39562611/c54613fa-f288-46b0-bc45-6ed85009478a

AlphaMensae commented 6 months ago

I think that is the anchoring system at work, the bane of my crew elevators in Modular Launch Pads. Introduced in KSP v1.9, it was supposed to help keep vessels stattionary on the ground, but it also affects Kerbals on EVA, especially standing still on a part.

kurgut commented 6 months ago

I think that is the anchoring system at work, [...] affects Kerbals on EVA, especially standing still on a part.

Indeed I have noticed it in your elevators ^^ It would be nice to disable this behavior for those situations. 👍

gotmachine commented 6 months ago

Seems the anchoring system might indeed be the cause of this. When idling, a kerbal will start in a "short" idling state, then transition to a "long" idling state after a while. My guess is that this transition is causing some conditions evaluated in KerbalEVA.AnchorUpdate() to change, leading to the ground anchor being removed, the kerbal entering the falling state, then the landing state, then the "short" idling state, and so on. For reference, this is what is reported when enabling the KerbalFSM debug mode (KerbalEVA.DebugFSMState), we can see the kerbal going from the Idle to Idle_b state, and the resulting fall event :

[LOG 12:01:12.336] [KerbalEVA]: Part:Jebediah Kerman-1736733733 FSM Event Called, Event:New Idle (Grounded)
[LOG 12:01:12.336] [KerbalEVA]: Part:Jebediah Kerman-1736733733 FSM State Changed, Old State:Idle (Grounded) New State:Idle_b (Grounded) Event:New Idle (Grounded)
[LOG 12:01:12.380] [KerbalEVA]: Part:Jebediah Kerman-1736733733 FSM Event Called, Event:Fall
[LOG 12:01:12.380] [KerbalEVA]: Part:Jebediah Kerman-1736733733 FSM State Changed, Old State:Idle_b (Grounded) New State:Idle (Floating) Event:Fall
[LOG 12:01:12.493] [KerbalEVA]: Part:Jebediah Kerman-1736733733 FSM Event Called, Event:Landing
[LOG 12:01:12.493] [KerbalEVA]: Part:Jebediah Kerman-1736733733 FSM State Changed, Old State:Idle (Floating) New State:Landing Event:Landing
[LOG 12:01:12.620] [KerbalEVA]: Part:Jebediah Kerman-1736733733 FSM Event Called, Event:Landed
[LOG 12:01:12.620] [KerbalEVA]: Part:Jebediah Kerman-1736733733 FSM State Changed, Old State:Landing New State:Idle (Grounded) Event:Landed

Edit : Well, the issue might be even more complex. RemoveRBAnchor() is called from AnchorUpdate() due to Vessel.Landed becoming false, and all this seemingly before the kerbal FSM state change happens.