From a1dd049fd3a9bb4daa64a1942bcfeb8f08d1bfe3 Mon Sep 17 00:00:00 2001 From: JonnyOThan Date: Sun, 5 Nov 2023 19:45:40 -0500 Subject: [PATCH] Fix #220: fix camera orientation when boarding from EVA --- FreeIva/FreeIva.cs | 5 +++-- FreeIva/KerbalIvaController.cs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/FreeIva/FreeIva.cs b/FreeIva/FreeIva.cs index 74bc5a7b..ba116807 100644 --- a/FreeIva/FreeIva.cs +++ b/FreeIva/FreeIva.cs @@ -182,9 +182,10 @@ static IEnumerator PostBoardCoroutine(ProtoCrewMember protoCrewMember, Collider if (!KerbalIvaAddon.Instance.buckled) { Vector3 position = matchingHatch.transform.TransformPoint(matchingHatch.inwardsDirection * 0.3f); - Vector3 hatchInwards = matchingHatch.transform.TransformVector(matchingHatch.inwardsDirection); + Vector3 hatchInwards = matchingHatch.transform.TransformDirection(matchingHatch.inwardsDirection); Quaternion rotation = Quaternion.LookRotation(hatchInwards, matchingHatch.internalModel.transform.up); - KerbalIvaAddon.Instance.KerbalIva.transform.SetPositionAndRotation(position, rotation); + KerbalIvaAddon.Instance.KerbalIva.transform.position = position; + KerbalIvaAddon.Instance.KerbalIva.SetCameraOrientation(rotation); } } } diff --git a/FreeIva/KerbalIvaController.cs b/FreeIva/KerbalIvaController.cs index 60504f05..9b069fb2 100644 --- a/FreeIva/KerbalIvaController.cs +++ b/FreeIva/KerbalIvaController.cs @@ -93,7 +93,7 @@ public void OrientToGravity() } } - void SetCameraOrientation(Quaternion rotation) + public void SetCameraOrientation(Quaternion rotation) { if (UseRelativeMovement()) {