02-02-2020, 05:43 PM
(02-02-2020, 04:57 PM)Lupp_ Wrote: So after getting side tracked for way too long trying to learn about ways to get around weird quirks in Unity, I'm finally at the point there I can interact with the controllers. Unfortunately I don't understand the syntax on how to do that.
What I want it to make is:
- A foreach loop and store all the absolute positions of the controllers from this, and store it in a new array.
Code:var selectedControllers = Selection.transforms.Select(t => t.gameObject.GetComponent<SplineController>()).Where(c => c != null).ToList();
- How to set those objects to a new absolute position based on the new modified array.
- How to get the end point of the controllers splines as an absolute value.
Hi,
- To set and get the absolute position, use the AbsolutePosition property.
- To store them in an array, you can use a simple foreach. If you want to use Linq (warning, this means a memory allocation at each call), you can do this: Selection.transforms.Select(t => t.gameObject.GetComponent<SplineController>()).Where(c => c != null).Select(c => c.AbsolutePosition).ToList()
- If I understood correctly you question about the end point, you need to use the CurvySpline.Length property
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.