I am trying to make my own Spline Animation component and it works fine.
But when I move around and rotate the SplineContainer the knot positions stay in their original locations.
I am trying to make my own Spline Animation component and it works fine.
But when I move around and rotate the SplineContainer the knot positions stay in their original locations.
Splines work in local space so you have to transform the points from local to world space. You can use the matrix provided by your gameObject like
transform.localToWorldMatrix().MultiplyPoint( yourPosition );
Thank you, that was exactly what I needed! But is there a way to also have the rotations of the knots transform too?
Never mind, I found it.
newKnot.Rotation = splineContainer.transform.rotation * knot.Rotation;