How do i get updated knot locations on a rotated splinecontainer

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.

Is there a way to get the updated locations?

3 Answers

3

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;