Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Position SetFromString
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.
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 (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.
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!

Possibly Related Threads…
Thread Author Replies Views Last Post
  Get position of all control points for a spline gekido 1 6 03-28-2024, 10:08 PM
Last Post: _Aka_
  Avoiding runtime GC allocations on control point position change Ell223 8 18 02-24-2024, 10:43 AM
Last Post: _Aka_
  How could I get position in spline from "From" value in BuildRasterizedPath? Chanon 1 8 02-12-2024, 09:54 PM
Last Post: _Aka_
  Finding relative position across connected splines DekoGames 1 8 02-05-2024, 10:11 PM
Last Post: _Aka_

Forum Jump: