From ca5ef109ac5c4e1ea5a51f68818632385388aec5 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 29 Jul 2022 20:43:19 +0900 Subject: [PATCH] [Survey] Use part origin instead of vessel origin In the end, I don't think supporting unloaded stakes is worth it, so this is probably the best solution to having the CoM not necessarily on the part origin. Fixes incorrect height for the stake CoM offset trick for stock inventory. --- Source/Survey/Points.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/Survey/Points.cs b/Source/Survey/Points.cs index f5355656..67a57f0a 100644 --- a/Source/Survey/Points.cs +++ b/Source/Survey/Points.cs @@ -45,8 +45,11 @@ public Points (SurveySite site) center = Vector3d.zero; foreach (var stake in site) { + if (stake.stake == null) { + continue; + } string key = ELSurveyStake.StakeUses[stake.use]; - var pos = stake.vessel.GetWorldPos3D (); + var pos = stake.stake.part.transform.position; center += pos; count++;