Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create an arrow dynamically following the spline
#17
(10-05-2017, 08:54 PM)Roger Cabo Wrote: I think that have to do with Initializing the complete spline system at start.
Are you sure the splines are fully initialized when you use it?

Code:
 IEnumerator Start() {
          foreach (var Spline in FindObjectsOfType(typeof(CurvySpline)) as CurvySpline[]) {
              while (!Spline.IsInitialized) {
                  yield return null;
              }
          }
      }

You can check this, if you wait a second, then calling your function.
public int frames;
Code:
void Update(){
  frames++;
  if (frames > 100)  run your function to create the arrow.

}

only an idea.


Thank you for the idea. I've check if the spline is initialized with a simple 
Code:
Debug.Log ("spline -> " + launcherSpline.IsInitialized);
And it returns always true. You made me doubt about if there is some problem with the initialization. I dont do an initalization at code, I create the curvy spline on the inspector with 3 Control Points, and it used to interpolate between them to make a smooth curve. But its no longer the case so with only the 3 Control Points, on sometimes it add a fourth one on the fly to interpolite a tiny bit but not enough to make a smooth curve. So I think is an interpolation problem, dont know if I have to do something else to make that interpolation works as a smooth curve. Is there any method to "initialize forcing the spline to have X positions based on just 3 Control Points?
Reply


Messages In This Thread
RE: Create an arrow dynamically following the spline - by yandrako - 10-06-2017, 09:33 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Curvy Line Renderer for UI Spline? gekido 3 6 04-04-2024, 12:56 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 6 03-28-2024, 10:08 PM
Last Post: _Aka_
Heart Create beautiful curves ShiroeYamamoto 3 11 03-26-2024, 06:25 PM
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_

Forum Jump: