Dreamteck / splines

The official Dreamteck Splines for Unity repository
Apache License 2.0
22 stars 2 forks source link

Add corner compensation to SplineMesh #1

Open Kronoxis opened 1 year ago

Kronoxis commented 1 year ago

The PathGenerator currently have the option to compensate corners for linear splines. This option however does not exist for the SplineMesh component. I added the necessary code to make this work, check out the Discord forum post about this for a preview.

You can also checkout the test branch for a test scene with the following tests:

This PR should not introduce any breaking changes, as the default behaviour of the SplineMesh remains unchanged. It simply exposes an optional setting to improve the mesh generation.

f007ch commented 1 year ago

The problem with the SplineMesh is that when it compensates corners, it also inflates the scale of the mesh along other axes. The path generator works well with this because it's flat but for meshes that occupy volume along the Y axis, this becomes a problem. I'm not sure how to handle this in terms of design yet. We might need to run this operation separately for each local axis of the sample.

Kronoxis commented 1 year ago

I have made the necessary modifications to leave original scale intact, and apply the compensation to X only. This produces the result below, which can be confirmed in the test branch image

I believe this is also an issue in the path generator currently when it has an offset in Y - the Y offset seems to scale along with compensation. I will create a new branch for this fix soon.