SHARE
TWEET

Curvy track walls fix

a guest Apr 26th, 2018 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  .../Packages/Curvy/Base/CG Modules/BuildShapeExtrusion.cs | 15 ++++++++++++++-
  2.  1 file changed, 14 insertions(+), 1 deletion(-)
  3.  
  4. diff --git a/Assets/Packages/Curvy/Base/CG Modules/BuildShapeExtrusion.cs b/Assets/Packages/Curvy/Base/CG Modules/BuildShapeExtrusion.cs
  5. index ef54258..fd6c899 100644
  6. --- a/Assets/Packages/Curvy/Base/CG Modules/BuildShapeExtrusion.cs 
  7. +++ b/Assets/Packages/Curvy/Base/CG Modules/BuildShapeExtrusion.cs 
  8. @@ -101,6 +101,14 @@ namespace FluffyUnderware.Curvy.Generator.Modules
  9.          [Label("Reverse Normal", "Reverse Vertex Normals?")]
  10.          [SerializeField]
  11.          bool m_CrossReverseNormals;
  12. +        [Header("Track walls fix")]
  13. +        [SerializeField]
  14. +        float TrackWidth = 0;
  15. +        [SerializeField]
  16. +        [AnimationCurveEx("Track Scale Curve")]
  17. +        AnimationCurve TrackScaleCurve = AnimationCurve.Linear(0, 0, 1, 0);
  18. +        [SerializeField]
  19. +        bool IsRightWall;
  20.          #endregion
  21.  
  22.          #region TAB: Scale
  23. @@ -741,7 +749,12 @@ namespace FluffyUnderware.Curvy.Generator.Modules
  24.                      Quaternion R = Quaternion.LookRotation(path.Direction[sample], path.Normal[sample]);
  25.  
  26.                      getScaleInternal(scaleFArray[sample], baseScale, ref scl);
  27. -                    Matrix4x4 mat = Matrix4x4.TRS(path.Position[sample], R, scl);
  28. +                    Vector3 position = path.Position[sample]
  29. +                        + R * (IsRightWall ? Vector3.left : Vector3.right) *
  30. +                            (TrackWidth * (1 - TrackScaleCurve.Evaluate(scaleFArray[sample])));
  31. +                    Matrix4x4 mat = Matrix4x4.TRS(position, R, scl);
  32. +
  33. +
  34.                      Matrix4x4 matHollow = volHollow
  35.                          ? Matrix4x4.TRS(path.Position[sample], R, scl * (1 - HollowInset))
  36.                          : default(Matrix4x4);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top