Merge pull request #913 from taniwha/launchclamp_el_compat

Pre-rotate the anchor transform
develop
Andrew Cassidy 4 years ago committed by GitHub
commit aaaa4d097a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -22,6 +22,7 @@ namespace Restock
public LaunchClampGirderFactory girderFactory;
private int _girderSegments;
private Quaternion towerRot;
private Material _girderMaterial;
private Matrix4x4[] _girderMatrices;
@ -63,12 +64,28 @@ namespace Restock
girderFactory.Initialize(girderMesh, girderSegmentHeight, maxSegments);
}
}
if (node.HasValue ("towerRot"))
{
string rot = node.GetValue ("towerRot");
towerRot = KSPUtil.ParseQuaternion (rot);
}
_girderSegments = 1;
base.OnLoad(node);
}
public void RotateTower ()
{
// transforms found in OnLoad
float height = Vector3.Distance (towerAnchor.position, towerStretch.position);
//Debug.Log($"[ModuleRestockLaunchClamp] RotateTower: {height} {towerRot}");
towerPivot.localRotation = towerRot;
towerAnchor.localRotation = towerRot;
towerAnchor.position = towerStretch.position - towerStretch.up * height;
}
public override void OnStart(StartState state)
{
base.OnStart(state);
@ -144,4 +161,4 @@ namespace Restock
girderMeshFilter.mesh = girderFactory.makeGirder(girderSegments);
}
}
}
}

Loading…
Cancel
Save