Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create an arrow dynamically following the spline
#11
Yes, I'm back online again (moved housing, switched ISP), sorry for the delay.

Looks like the spline massively lost cache points somehow, interesting...to test this, inside CurvyLineRenderer.cs, could you please add a debug log to Refresh():

Code:
public void Refresh()
{
Debug.Log(Spline.CacheSize);
...
}


and see if it got the same value in gamemode and standalone?

Or - even better and to speed this up, would you mind to send me a scene export to jake<at>fluffyunderware.com, I'll look into this asap.

Thanks,
Jake
Reply
#12
(04-05-2017, 06:42 PM)Jake Wrote: Yes, I'm back online again (moved housing, switched ISP), sorry for the delay.

Looks like the spline massively lost cache points somehow, interesting...to test this, inside CurvyLineRenderer.cs, could you please add a debug log to Refresh():

Code:
public void Refresh()
{
Debug.Log(Spline.CacheSize);
...
}


and see if it got the same value in gamemode and standalone?

Or - even better and to speed this up, would you mind to send me a scene export to jake<at>fluffyunderware.com, I'll look into this asap.

Thanks,
Jake


Hello Jake, hope all  the moving was nice Smile
I've just send you an email to this address admin@fluffyunderware.com with an about that begins with "For Jake: Create.." explaining everything about it. I think its all right so I awayt your miracle as always.
Thanks
Yandrako
Reply
#13
(04-06-2017, 10:59 AM)yandrako Wrote:
(04-05-2017, 06:42 PM)Jake Wrote: Yes, I'm back online again (moved housing, switched ISP), sorry for the delay.

Looks like the spline massively lost cache points somehow, interesting...to test this, inside CurvyLineRenderer.cs, could you please add a debug log to Refresh():

Code:
public void Refresh()
{
Debug.Log(Spline.CacheSize);
...
}


and see if it got the same value in gamemode and standalone?

Or - even better and to speed this up, would you mind to send me a scene export to jake<at>fluffyunderware.com, I'll look into this asap.

Thanks,
Jake


Hello Jake, hope all  the moving was nice Smile
I've just send you an email to this address admin@fluffyunderware.com with an about that begins with "For Jake: Create.." explaining everything about it. I think its all right so I awayt your miracle as always.
Thanks
Yandrako


It seems when I test the project (on editor as well) on a mac I have the same problem, maybe some kind of quality setting or something like that? I know you are busy, just telling you that in case that could help on the debugging when you can Smile

Thanks
Yandrako
Reply
#14
Eo? still waiting your reply, thanks in advance Smile
Reply
#15
Since Unity 5.6 I have the same problem of only 3 points on the spline even on the editor and game mode. Please check it out as soon as you can and sorry for the spam, but its the main mechanic of my game Sad
Reply
#16
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.
(Henry Ford) Each hour more of searching is each hour less of your live time.

Reply
#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
#18
>>>> Is there any method to "initialize forcing the spline to have X positions based on just 3 Control Points?

1) You can force with Spline.Refresh(). It doesn't matter how many points a spline have. If its initialized, then its initialized and ready to go.
2) Sometimes at the first frame you get Isinitialized=true but it's not. I recommended in your situation to start after 30 or 60 frames your arrow stuff for testing purposes.
Otherwise I canNOT help you if you not follow some basic rules about Initializing and check stuff as I told you.

Further you can post a small example. So ppl can help you.
(Henry Ford) Each hour more of searching is each hour less of your live time.

Reply
#19
Thank you again for the reply.

When I said I have checked the isInitialized was true I didnt put it at the beginning, I put it on Update so I can check every frame and I get allways true, not a single false. Either way I have used the coroutine you told me to check it and makes no difference. I dont wait to create the arrow because the arrow is already created on a prefab, not by code.

Whats even weirder is it worked as intended with previous versions of Unity, but only on scene mode, never on a compiled build. With the latter versions I have the same problem in scene mode, game mode and compiled build.

I also create a simplified version for anyone who can help me, you will get lots of warnings for other reasons (mostly because other assets, you can ignore them) but no crashes. To see the spline you have a card launcher on the middle botton on the screen, click on the card of the top to begin the launch and drag to create a path (with your spline asset). Release to throw the card and again the mouse button to retrieve de card. I think thats all you need to check the problem.


If you have any doubt dont hesitate to ask. Thank you so much in advance Smile
Reply
#20
Hi,

on my PC results of editor playing and standalone exe are the same. The spline uses very few cache points due it's small size. That's why UI Spline was created. To get around this for regular splines, set the Cache PPU (Max. Cache Points per Unit) to a higher value in the global preferences. I changed it from 8 (default) to 20 and raised Cache Density of LauncherSpline to 100 to get somewhat smooth results.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Curvy Line Renderer for UI Spline? gekido 1 1 Yesterday, 10:12 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 2 Yesterday, 10:08 PM
Last Post: _Aka_
Heart Create beautiful curves ShiroeYamamoto 3 9 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: