Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Converting spline collider hit point to spline position
#1
Hi again,

I'm trying to add an object (let's say a cube) to a spline at the position where the spline was clicked. I'm using raycast and can get the spline clicked hit.point no issue, but how do I then convert that to an actual spline position so I can then add and move the cube to the correct location on the spline?

Many thanks (once again) for your valuable time

John
Reply
#2
Hi,
I don't get something: you said you already get the hit point on the spline. Isn't that what you are asking for? Maybe with a drawing or a screenshot I can understand you better
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply
#3
Ah, no sorry I'm after the spline.Position value of that hit point (I am using Position Mode as Absolute).
Reply
#4
1- Use spline.GetNearestPointTF to get the corresponding TF.
2- Use spline.TfToDistanceto get the corresponding distance
3- the corresponding splineController.Position is distance/spline.Distance
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply
#5
Hello and thank you for your reply.

In your step 3, there is no spline.Distance property, where would I obtain that from please.

thanks

John
Reply
#6
Sorry, my bad, I meant spline.Length
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply
#7
Thank you for your help!
Reply
#8
you are welcome
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  SplineController Ignores Follow-Up and Chooses Wrong Spline Josenildo 7 2,965 07-29-2025, 09:15 PM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 7 4,372 07-13-2025, 07:11 PM
Last Post: _Aka_
  Is there a way to get the position of each ControlPoint in spline by API? Chanon 1 1,612 06-07-2025, 09:44 AM
Last Post: _Aka_
  12_Train junction point richardzzzarnold 5 2,529 04-16-2025, 02:19 PM
Last Post: _Aka_

Forum Jump: