05-10-2024, 04:56 AM
Thank you for your quick reply.
Unfortunately, that does help and perhaps I have not been clear enough. I have already looked at the API entry for CurvySplineSegment and I cannot understand what needs to happen to solve what I am trying to do, as I explained above.
I am not trying to simply twist a spline all at once (e.g. by setting mySpline.Turns = 2), but I want to continuously rotate the spline to arrive at the final rotation. So I tried this:
for (int i = 0; i < Single_Ribbon_Spline.ControlPointsList.Count- 2; i++) // the number of segments is 1 less than the number of CPs by definition, but we do not want to twist the last segment, hence why the index is -2
{
CurvySplineSegment thisSegmentToTwist = Single_Ribbon_Spline.ControlPointsList[i];
thisSegmentToTwist.transform.rotation = Quaternion.Euler(syncEulerAngles.y, 0, 0); // rotate each segment
msh_0.transform.rotation = Single_Ribbon_Spline.transform.rotation; // this works but twists the entire spline including what should be the fixed end
}
That does not work and I do not know why.
I do not know how orientation anchors will help. -Perhaps they are the answer, but the API documentation lacks clear examples to explain how that might work.
So lets try again with a simple conceptual example:
We have a cube on each end of a spline.
Both cubes are attached (parented? somehow anchored?) to the spline.
One cube remains fixed (Cube 1), while the other cube (Cube 2) rotates continuously sharing the same axis as the spline.
Because Cube 2 is rotating, the result will be that the spline (and its associated mesh with enough vertices) twists like a rope.
If we continue twisting it will knot up, if we reverse twist it will unknot -just like a rope.
Sounds simple but I have hit a wall with the API and referring me back to it at this point will not help.
Given that your expertise with Curvy far exceeds my own at the moment, can you (or anyone) provide a code sample showing how what I am trying to implement can be accomplished? Suggestion: it would be great to add something like this to the Curvy deformation examples!
Unfortunately, that does help and perhaps I have not been clear enough. I have already looked at the API entry for CurvySplineSegment and I cannot understand what needs to happen to solve what I am trying to do, as I explained above.
I am not trying to simply twist a spline all at once (e.g. by setting mySpline.Turns = 2), but I want to continuously rotate the spline to arrive at the final rotation. So I tried this:
for (int i = 0; i < Single_Ribbon_Spline.ControlPointsList.Count- 2; i++) // the number of segments is 1 less than the number of CPs by definition, but we do not want to twist the last segment, hence why the index is -2
{
CurvySplineSegment thisSegmentToTwist = Single_Ribbon_Spline.ControlPointsList[i];
thisSegmentToTwist.transform.rotation = Quaternion.Euler(syncEulerAngles.y, 0, 0); // rotate each segment
msh_0.transform.rotation = Single_Ribbon_Spline.transform.rotation; // this works but twists the entire spline including what should be the fixed end
}
That does not work and I do not know why.
I do not know how orientation anchors will help. -Perhaps they are the answer, but the API documentation lacks clear examples to explain how that might work.
So lets try again with a simple conceptual example:
We have a cube on each end of a spline.
Both cubes are attached (parented? somehow anchored?) to the spline.
One cube remains fixed (Cube 1), while the other cube (Cube 2) rotates continuously sharing the same axis as the spline.
Because Cube 2 is rotating, the result will be that the spline (and its associated mesh with enough vertices) twists like a rope.
If we continue twisting it will knot up, if we reverse twist it will unknot -just like a rope.
Sounds simple but I have hit a wall with the API and referring me back to it at this point will not help.
Given that your expertise with Curvy far exceeds my own at the moment, can you (or anyone) provide a code sample showing how what I am trying to implement can be accomplished? Suggestion: it would be great to add something like this to the Curvy deformation examples!

