I am trying to create a spline with parallel points and tangents.
I managed to make the points parallel, but I don’t know how to adjust the tangent scale, so the curves are not parallel. I’ve also tried scaling based on curvature, but the results are unsatisfactory.
Is there anyone who is good at solving problems like this?
Get all points and tangents. Add an offset vector to foreach points and set on other spline?
PS: If you are trying to do a parallel just preserving the tangent and copy everything will work and it would be parallel. If you are trying to do with an offset like (the total length changing) a road’s sidewalk then you have to get normal of tangent, dot product to right vector, then add offset vector to the original vector and set spline points on the new target for each point. Again setting custom splines tangent should work.
Is that a way to add points to a spline? Is there a way to address this by scaling the tangent?
The pink spline is a child of the white spline, and I want to edit the pink spline relative to the white spline points. The spline points already behave as desired, but the curve does not.
So when it comes to actually 1:1 being parallel what you mean can be different as mentioned before.
In your example of the pink, its an offset to the curve itself meaning the length and the points positions are not the same anymore. Its like white is the road, and pink is the pavement following the road, yes they are parallel however turns and curves tangents are not the same anymore they are adjusted. If you want to do that (scaling) simply.
This would simply segment the spline and recreate many points but true parallel as you ask. The points on the target will not be matching the spline original interms of number however shape direction wise it will be very accurate, till your turns are bigger than the offset then as nature it should be clamped.
Yes, this is certainly the behavior I want. However, this number of spline points is excessive and requires a large number of loops when applying the spline mesh, which is not desirable.
In theory, we should be able to get the same curve as the original spline by simply scaling the tangents. I got pretty close, but it’s not practical due to the curve error.
But seriously, how do other people make multi-lane roads? Is it just made from one mesh? In that case, creating a traffic system would be quite difficult.
Yeah if curve radius greater than the offset can break, however you can eliminate them by detecting angle if necessary. or you can check if angle is below some number before you setting the new point.
Happy that it works for you but also would like to recommend maybe using 1 spline but multiroad mesh setup (2 Lane) that would lover the usage splines creted nested to each other.
That seems to be the best. I’ve tried various things, setting the position and tangent from the spline points, filtering the first index, etc. but I couldn’t solve this problem. I also noticed that it doesn’t support twisting. I’m abandoning this solution.