07-29-2022, 03:01 PM
Hi
Thank you for the reproduction case.
From what I can see, the issue is due to minor imprecision in the computation of the tangents/handles. One can pursue fixing the imprecision, but I am thinking about a simpler solution: generate the track as a single mesh. When done like that, no gaps appear. This solution has two variants: either generating the whole track as a single mesh at each update of the spline, or keep your current solution when putting spline CPs (left clicks) and generate the whole spline only at the end of the spline drawing process (right click).
Compared to your solution, the downside of the one I suggest is of course lesser performance, but I am wondering if in your scenario the cost of generating the whole track as a single mesh is really a problem. This is a genuine question, since I don't know what are your constraints. As I can see from what you shared with me, the setup of your generator can be optimize if some conditions are met. For example, avoid generating the mesh collider when drawing the spline (I guess at that point no physics interactions are supposed to happen?). Also, you can avoid generating the UV2 coordinates, as long as you don't need them for light-map baking.
Also, this page might be helpful in the optimization process: https://curvyeditor.com/documentation/performancetips/start
Did this help?
Have a nice day
Thank you for the reproduction case.
From what I can see, the issue is due to minor imprecision in the computation of the tangents/handles. One can pursue fixing the imprecision, but I am thinking about a simpler solution: generate the track as a single mesh. When done like that, no gaps appear. This solution has two variants: either generating the whole track as a single mesh at each update of the spline, or keep your current solution when putting spline CPs (left clicks) and generate the whole spline only at the end of the spline drawing process (right click).
Compared to your solution, the downside of the one I suggest is of course lesser performance, but I am wondering if in your scenario the cost of generating the whole track as a single mesh is really a problem. This is a genuine question, since I don't know what are your constraints. As I can see from what you shared with me, the setup of your generator can be optimize if some conditions are met. For example, avoid generating the mesh collider when drawing the spline (I guess at that point no physics interactions are supposed to happen?). Also, you can avoid generating the UV2 coordinates, as long as you don't need them for light-map baking.
Also, this page might be helpful in the optimization process: https://curvyeditor.com/documentation/performancetips/start
Did this help?
Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.