Converter 1.2.0 is now available. Here is the release notes:

Currently, there are some limitations regarding converting Curvy Splines to Unity Splines. I aim to lift these limitations in the future:

Code:

`### Added`

- Conversion from Curvy splines to Unity splines.

- Messages window, available at Window -> Converter -> Messages.

- Menu item to open the asset's publisher's page.

### Changed

- Converter now compiles even if Curvy Splines is missing.

- Minimum Curvy Splines compatible version is now 8.9.1.

### Fixed

- Newly created splines are not converted automatically.

- Converting a Unity spline removes all its children.

Currently, there are some limitations regarding converting Curvy Splines to Unity Splines. I aim to lift these limitations in the future:

- You can't convert B Splines and TCB splines.

- The converted Catmull-Rom splines can be different from the source spline. This is due to a bug in Unity's splines package. Here is a scene with a spline made to make the difference very visible:

Unity vs Curvy.unity (Size: 31.27 KB / Downloads: 1)

And here is a reference implementation in python. You can see that Unity's implementation (yellow spline) does not match the reference implementation.

Code:`import numpy as np`

import matplotlib.pyplot as plt

def catmull_rom_spline(P0, P1, P2, P3, n_points=100):

t = np.linspace(0, 1, n_points)

t2 = t**2

t3 = t**3

# Catmull-Rom matrix

M = np.array([

[-0.5, 1.5, -1.5, 0.5],

[ 1.0, -2.5, 2.0, -0.5],

[-0.5, 0.0, 0.5, 0.0],

[ 0.0, 1.0, 0.0, 0.0]

])

# Geometry vector

Gx = np.array([P0[0], P1[0], P2[0], P3[0]])

Gz = np.array([P0[1], P1[1], P2[1], P3[1]])

# Calculate the spline points

T = np.array([t3, t2, t, np.ones_like(t)])

X = np.dot(M, Gx)

Z = np.dot(M, Gz)

x = np.dot(X, T)

z = np.dot(Z, T)

return x, z

# Control points

control_points = [

(-6.291999816894531, -0.13099999725818635),

(-6.291999816894531, -0.13099999725818635),

(2.308000087738037, 2.569000005722046),

(2.388000011444092, 0.14899998903274537),

(3.138000011444092, 0.0989999920129776),

(-0.07699990272521973, -1.3380000591278077),

(-0.42200005054473879, -0.23100002110004426),

(-0.42200005054473879, -0.23100002110004426)

]

# Plot the control points

x_control = [p[0] for p in control_points]

z_control = [p[1] for p in control_points]

# Calculate spline segments

x_spline = []

z_spline = []

for i in range(len(control_points) - 3):

x, z = catmull_rom_spline(control_points[i], control_points[i+1], control_points[i+2], control_points[i+3])

x_spline.extend(x)

z_spline.extend(z)

# Plotting

plt.figure(figsize=(10, 6))

plt.plot(x_spline, z_spline, label='Catmull-Rom Spline')

plt.scatter(x_control, z_control, color='red', label='Control Points', s=100)

plt.legend()

plt.xlabel('X')

plt.ylabel('Z')

plt.title('Catmull-Rom Spline')

plt.grid(True)

plt.gca().set_aspect('equal', adjustable='box')

# Setting 1x1 grid with round values

x_min, x_max = np.floor(min(x_control)), np.ceil(max(x_control))

z_min, z_max = np.floor(min(z_control)), np.ceil(max(z_control))

plt.xticks(np.arange(x_min, x_max + 1, 1))

plt.yticks(np.arange(z_min, z_max + 1, 1))

plt.show()

Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.