Skip to content

Commit

Permalink
Ignoring certain part modules w/o meshes that cause bound calcs to fr…
Browse files Browse the repository at this point in the history
…eak out - todo: make this accessbile w/ config file
  • Loading branch information
gomker committed Jan 1, 2017
1 parent f5d66ef commit 498806c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
Binary file modified Distribution/GameData/VesselMover/Plugins/VesselMover.dll
Binary file not shown.
36 changes: 28 additions & 8 deletions VesselMove.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

namespace VesselMover
Expand Down Expand Up @@ -629,7 +630,13 @@ public void UpdateBounds()

foreach(Part p in vessel.parts)
{
float sqrDist = Vector3.ProjectOnPlane((p.transform.position-vessel.CoM), up).sqrMagnitude;
if (p.Modules.Contains("Tailhook")) return ;
if (p.Modules.Contains("Arrestwire")) return;
if (p.Modules.Contains("Catapult")) return;
if (p.Modules.Contains("CLLS")) return;
if (p.Modules.Contains("OLS")) return;

float sqrDist = Vector3.ProjectOnPlane((p.transform.position-vessel.CoM), up).sqrMagnitude;
if(sqrDist > maxSqrDist)
{
maxSqrDist = sqrDist;
Expand All @@ -647,12 +654,11 @@ public void UpdateBounds()
//bottom check
Vector3 worldVertPoint = mf.transform.TransformPoint(vert);
float bSqrDist = (downPoint-worldVertPoint).sqrMagnitude;
if(bSqrDist < closestSqrDist)
{
closestSqrDist = bSqrDist;
closestVert = worldVertPoint;
}

if (bSqrDist < closestSqrDist)
{
closestSqrDist = bSqrDist;
closestVert = worldVertPoint;
}

//radius check
//float sqrDist = (vessel.CoM-worldVertPoint).sqrMagnitude;
Expand Down Expand Up @@ -711,6 +717,20 @@ public void UpdateBounds()

}

}
public static List<string> partIgnoreModules = new List<string>(9)
{
"Tailhook",
"Arrestwire",
"Catapult",
"CLLS",
"OLS"
};

private static bool IsPartModuleIgnored(string ModuleName)
{
return true;
}

}
}

0 comments on commit 498806c

Please sign in to comment.