Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Best way to duplicate a spline with an offset
#5
Thank you for the response.

Unfortunately defining the space doesn't seem to affect the outcome.
I really feel like I'm missing something here. Any idea's?

Thank you so much in advance!

Code:
private Vector3 CalculateOffset(CurvySplineSegment originalSplineSegment)
        {
            if (originalSplineSegment == null)
                return Vector3.zero;

            Vector3 tangent = m_CurvySpline.GetTangent(originalSplineSegment.TF, Space.Self);
            Vector3 worldTangent = m_CurvySpline.GetTangent(originalSplineSegment.TF, Space.World);
            Vector3 perpendicularTangent = Vector3.Cross(worldTangent, originalSplineSegment.transform.up);

            Vector3 offset = perpendicularTangent * m_Offset;

            Debug.DrawLine(originalSplineSegment.transform.position, originalSplineSegment.transform.position + (tangent * m_Offset * 2.0f), Color.yellow, 10.0f);
            Debug.DrawLine(originalSplineSegment.transform.position, originalSplineSegment.transform.position + (worldTangent * m_Offset), Color.orange, 10.0f);
            Debug.DrawLine(originalSplineSegment.transform.position, originalSplineSegment.transform.position + (perpendicularTangent * m_Offset), Color.red, 10.0f);

            return offset;
        }


Attached Files Thumbnail(s)
   
Reply


Messages In This Thread
RE: Best way to duplicate a spline with an offset - by Kapistijn - 02-05-2026, 09:33 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Spline Spots from 2 samples. BitBlit 8 524 06-30-2026, 11:49 AM
Last Post: _Aka_
Smile Constant speed along a spline? tfishell 1 848 11-13-2025, 11:32 AM
Last Post: _Aka_
  SplineController Ignores Follow-Up and Chooses Wrong Spline Josenildo 7 4,851 07-29-2025, 09:15 PM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 7 6,749 07-13-2025, 07:11 PM
Last Post: _Aka_

Forum Jump: