diff --git a/Distribution/Restock/GameData/ReStock/Plugins/Restock.dll b/Distribution/Restock/GameData/ReStock/Plugins/Restock.dll index 07933d32..2481f09f 100644 Binary files a/Distribution/Restock/GameData/ReStock/Plugins/Restock.dll and b/Distribution/Restock/GameData/ReStock/Plugins/Restock.dll differ diff --git a/Source/Restock/ModuleRestockLinkedMesh.cs b/Source/Restock/ModuleRestockLinkedMesh.cs index 39cf0d15..bb9ef2e8 100644 --- a/Source/Restock/ModuleRestockLinkedMesh.cs +++ b/Source/Restock/ModuleRestockLinkedMesh.cs @@ -27,6 +27,12 @@ namespace Restock // initial scale of the pipe object, may not be 1 private float baseStretch; + + // scale vector for the material + private Vector2 texScale = Vector2.one; + + // offset vector for the material + private Vector2 texOffset = Vector2.zero; public override void OnStart(StartState state) @@ -76,15 +82,17 @@ namespace Restock // updates the texture stretch to match the pipe object's local scale private void UpdateStretch() { - var stretch = line.localScale.z; - var scaleVect = Vector2.one; - scaleVect[pipeStretchIndex] = stretch / baseStretch; + var stretch = line.localScale.z / baseStretch; + + texScale[pipeStretchIndex] = stretch; + texOffset[pipeStretchIndex] = (1 - stretch) / 2; foreach (var material in pipeMaterials) { foreach (var id in pipeMaterialIDs) { - material.SetTextureScale(id, scaleVect); + material.SetTextureScale(id, texScale); + material.SetTextureOffset(id, texOffset); } } }