Bug #14194
Navball doesn't follow the kerbal when on EVA
Status:
Closed
Severity:
Low
Assignee:
-
Category:
Gameplay
Target version:
-
Start date:
03/12/2017
% Done:
100%
Language:
English (US)
Mod Related:
No
Votes:
Description
This was a "feature" added back in 1.0.5: see the Navball section here:http://wiki.kerbalspaceprogram.com/wiki/1.0.5 .
I've fixed it in EVA Enhancements using the following code:
Transform target;
Vector3 rotationOffset = new Vector3(0f, 0f, 0f);
Quaternion attitudeGimbal;
CelestialBody currentMainBody;
static NavBall nav = FindObjectOfType<KSP.UI.Screens.Flight.NavBall>(); // cache somewhere
private void LateUpdate()
{
if (!FlightGlobals.ActiveVessel.isEVA || !settings.evaNavballFollowsKerbal)
return;
currentMainBody = FlightGlobals.currentMainBody;
target = FlightGlobals.ActiveVessel.vesselTransform;
attitudeGimbal = Quaternion.Euler(rotationOffset) * Quaternion.Inverse(target.rotation);
nav.navBall.rotation = attitudeGimbal * Quaternion.LookRotation(Vector3.ProjectOnPlane(currentMainBody.position + (currentMainBody.transform.up * (float)currentMainBody.Radius) - target.position, (target.position - currentMainBody.position).normalized).normalized, (target.position - currentMainBody.position).normalized);
}
And using EVA Enhancements, can now flip between modes.. But really, I don't understand why it was done this way.
History
#1 Updated by Robert.Keech over 4 years ago
- Status changed from New to Updated
- % Done changed from 0 to 10
Issue no longer occurs
#2 Updated by Robert.Keech over 4 years ago
- Status changed from Updated to Resolved
- % Done changed from 10 to 100
#3 Updated by chris.fulton over 4 years ago
- Status changed from Resolved to Closed