Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how do I position a splineController on a spline in runtime to an exact position?
#6
Thanks I changed to a relative position and went from there, works nicely however in the end I had to make it a coroutine and do a while loop to make it / force it to go to the place I wanted, seems sometimes spline controllers go to 0... took about 5~10 frames before it went to the correct position. heres the code:

Code:
    IEnumerator PlaceOnOpenTrack()
    {
        mySC.Spline = myPath;
        float desiredPos = path1.Length + (path2.Length * 0.5f);
        mySC.Position = desiredPos;
        if (mySC.Position == 0)
        {
            while( mySC.Position == 0 )
            {
                // Debug.Log(mySC.Position);
                mySC.Position = desiredPos;
                yield return null;
            }
        }
    }
Reply


Messages In This Thread
RE: how do I position a splineController on a spline in runtime to an exact position? - by hawken - 01-18-2018, 04:19 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Spline Issue Leading to Unity Freeze Pankaj09 1 325 08-24-2026, 11:28 PM
Last Post: _Aka_
  Connecting Multiple Spline Nodes Issue Ritesh Kadam 1 282 08-22-2026, 11:24 PM
Last Post: _Aka_
  Spline Spots from 2 samples. BitBlit 8 1,345 06-30-2026, 11:49 AM
Last Post: _Aka_
  Best way to duplicate a spline with an offset Kapistijn 8 2,752 04-12-2026, 03:18 PM
Last Post: _Aka_

Forum Jump: