Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SplineController Initialization
#1
I've upgraded from using Curvy in Unity 4.3 to now Unity 5.2. I am having an issue with initialization and playing. Previously, I would call the Initialize function after assigning a CurvyPath to my object and that worked great. But now there is no Initialization function at all. And when I check the IsInitialized and IsPlaying properties when running the game, they are both false. Note that I have a SplineController component attached to my game object, but do not assign a CurvyPath to it. I later assign a CurvyPath in code during runtime. So it seems that something needs to be done after assigning the path so that everything with be initialized and start playing. I tried the Refresh function but that didn't work. I also tried calling Play, but that didn't work either. 

So, what do I need to do after assigning a path in code so that it'll get initialized and start playing?

EDIT: I see in the API introduction that I need to wait for IsInitialized to be true before using it, but in my case I'm not "using" it per se. I am simply assigning the CurvySpline to the SplineController and expecting it to automatically play. I don't actually do anything else beyond that. And no matter how long I wait, the IsInitialized is never true. So, there must be something else I'm missing.
Reply
#2
This issue is urgent. Does anyone have any ideas?
Reply
#3
The SplineController should be initialized and ready to go once a Spline is assigned and MoveMode is relative or Spline's Length>0. Can you check that?
Reply
#4
(12-14-2015, 06:28 PM)Jake Wrote: The SplineController should be initialized and ready to go once a Spline is assigned and MoveMode is relative or Spline's Length>0. Can you check that?

MoveMode is AbsolutePrecise and it is reporting Length = 0. So, why is the Length zero when it's a valid CurvySpline? I am instantiating the CurvySpline from a prefab as follows:

Code:
_splinePath = Instantiate(spawnData.splinePath) as CurvySpline;

_splinePath.RefreshImmediately();

And as soon as I check the Length after instantiating, it reports as zero. This worked in the Curvy version I was using for Unity 4.3.

EDIT: I see that RefreshImmediately is obsolete so I replaced with Refresh. It still has the same result.
Reply
#5
This issue is holding me up. Anyone have any other suggestions?
Reply
#6
Using Spline.Refresh() is absolutely right. Can you try to call Spline.SetDirtyAll() before, just to be sure...

If that does not help, it would be great if you can send me a scene or package by mail to jake<at>fluffyunderware<dot>.com
Reply
#7
(12-17-2015, 06:08 PM)Jake Wrote: Using Spline.Refresh() is absolutely right. Can you try to call Spline.SetDirtyAll() before, just to be sure...

If that does not help, it would be great if you can send me a scene or package by mail to jake<at>fluffyunderware<dot>.com

When I call SetDirtyAll() before calling Refresh, the spline is initialized now and the game objects move along the spline. However, the spline no longer resembles the prefab spline that it was created from. It has some crazy, convoluted spline that doesn't look anything like the original. I'll see if I can make a small sample project with the issue.

As I'm creating a test scene, the first thing I noticed is that when I create a Spline object, it automatically creates a _CurvyGlobal_ object in the scene. This object was not in my upgraded project. I don't know what it's purpose is, but I went ahead and added a new spline to my main game scene so that it would create this _CurvyGlobal_ object. However, having this object in the scene didn't help the situation so I'm continuing on to make a scene to demonstrate the issue.
Reply
#8
In the process of making the sample scene, I discovered that my old CurvySplines were set to Static and the default now is Dynamic. Although I believe they were set to Dynamic in the Unity 4.3 version, perhaps there was an upgrade issue. Anyway, with Dynamic on and the additional call to SetDirtyAll, it is working now. I'm just experiencing one issue with re-used objects not starting at the beginning of the spline, but I should be able to track that down.
Reply
#9
You mean dynamic orientation? That was called "Tangent" mode in Curvy 1, but the name was a bit misleading...
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Wink In SplineController OnPositionReachedList Event is missing shimizu 2 13 02-07-2022, 12:47 PM
Last Post: shimizu
  best way to rotate, change offset, and inset position of splinecontroller object smackledorf 1 24 01-17-2022, 01:39 PM
Last Post: _Aka_
  SplineController slows down approaching connections jh092 5 2,542 08-07-2020, 03:56 PM
Last Post: _Aka_
  make "GetCurrentControlPoint" in SplineController more accessable VampirasuGameStudio 2 2,060 04-19-2020, 02:03 PM
Last Post: _Aka_

Forum Jump: