So earlier I was just normalizing the tangents with length 1 which was creating problems since as I mentioned in the question that tangent length affects the curvature of the path so I modified that by reducing the length of the tangents, proportionally to the distance between points. distanceBetweenPoints
The value 0.8 is something that worked(I liked the onelook of it) for me so basically, my thought process behind that correctsis to keep 80% of the distance of 2 points instead of keeping 100% thus retaining the tangent lengthbetween points.
Vector3 tangentLS = default;
for (int i = 0; i < ropeSaveData.ropeCurvePoints.Count; i++)
{
// Calculate control point positions and tangent vector:
Vector3 currentPointPosition =
generatedRope.transform.InverseTransformPoint(ropeSaveData.ropeCurvePoints[i]);
if (i == 0)
{
Vector3 nextPointPosition =
generatedRope.transform.InverseTransformPoint(ropeSaveData.ropeCurvePoints[i + 1]);
float distanceBetweenPoints = Vector3.Distance(nextPointPosition, currentPointPosition);
distanceBetweenPoints = distanceBetweenPoints * 0.8f;
tangentLS = (nextPointPosition - currentPointPosition).normalized * distanceBetweenPoints;0.8;
}
else if (i < ropeSaveData.ropeCurvePoints.Count - 1)
{
Vector3 previousPointPosition =
generatedRope.transform.InverseTransformPoint(ropeSaveData.ropeCurvePoints[i - 1]);
Vector3 nextPointPosition =
generatedRope.transform.InverseTransformPoint(ropeSaveData.ropeCurvePoints[i + 1]);
float distanceBetweenPoints = Vector3.Distance(nextPointPosition, currentPointPosition);
distanceBetweenPoints = distanceBetweenPoints * 0.8f;
tangentLS = (nextPointPosition - previousPointPosition).normalized * distanceBetweenPoints;0.8;
}
// Build the rope path:
blueprint.path.AddControlPoint(currentPointPosition, -tangentLS, tangentLS, Vector3.up,
0.1f, 0.1f, 1, filter, Color.white, "start_" + i);
}