Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Position SetFromString
#1
Hey there,
At first i wanna say that i already searched the documentations und forum for this problem, but did not find anything and wanna tell you a short summary of the project iam working on, so you could understand my problem better:
Iam working on an large project with ~120 km of railwaytracks. Everything is set up fine with curvy splines and controllers and so on. trains are traveling on the splines, but now i have the task to let the camera drive over the spline (thats fine too) and to be able to teleport to specific positions along the track.

Its easy to make an button and add the on click () "SplineController.SetFromString Position=50000" (Position is absolute), but now i have to implement an InputField where the customer can input an number he wishes and then only has to click the button and get teleportet to the desired position, but i dont know how to get the string from the InputField out and insert it into the on click () "SplineController.SetFromString Position=DesiredPosition" or if there is an better solution to achieve the same thing?

Yet another problem is the other way around:
As my camera travels along the spline i can see the absolute position updating in the editor, but i need to have it shown in another TextField in my UI, but dont know how to get the updating position number.

Hopefully you can help me with these problems and best regards.
Reply
#2
Hi,
Your question is not really Curvy related, but Unity's UI related. The only thing to know Curvy wise is the name of the property to read/write, which you already know about.
I made you a a scene and test script that do (in an unpolished way) what you are trying to do. By taking a look at them, you should understand how to setup the UI.
Let me know if you still have any other question.
Have a nice day


Attached Files
.zip   Vectorvision.zip (Size: 7.36 KB / Downloads: 1)
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
Thats exactly what i wanted to achieve, but unfortunally didnt know the exact names for the properties and could not find it in the SplineController script (like "AbsolutePosition" is never used in the SplineController.cs, just "RelativePosition" and "AbsolutePrecise" but the later one did not work)

Tanks for the great and fast support!
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Spline Controller Position Force Update ? UsernameHed 1 97 05-16-2019, 12:20 PM
Last Post: _Aka_
  Using timeline to manually animate curvy position. gtpdz 5 1,237 12-20-2018, 08:47 PM
Last Post: gtpdz
  Closest Point on Spline (+Offset) to some World Position nomadigi 10 6,115 01-26-2018, 08:59 PM
Last Post: _Aka_
  how do I position a splineController on a spline in runtime to an exact position? hawken 8 5,070 01-19-2018, 12:01 PM
Last Post: _Aka_

Forum Jump: