mirror of
https://github.com/PorktoberRevolution/ReStocked
synced 2024-09-01 17:34:42 +00:00
Merge pull request #913 from taniwha/launchclamp_el_compat
Pre-rotate the anchor transform
This commit is contained in:
commit
aaaa4d097a
@ -22,6 +22,7 @@ namespace Restock
|
||||
public LaunchClampGirderFactory girderFactory;
|
||||
|
||||
private int _girderSegments;
|
||||
private Quaternion towerRot;
|
||||
|
||||
private Material _girderMaterial;
|
||||
private Matrix4x4[] _girderMatrices;
|
||||
@ -64,11 +65,27 @@ namespace Restock
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user