Comments and answers for "How to control an animation by touch position along a path?"
http://answers.unity.com/questions/516124/how-to-control-an-animation-by-touch-position-alon.html
The latest comments and answers for the question "How to control an animation by touch position along a path?"Comment by Sajidfarooq on Sajidfarooq's answer
http://answers.unity.com/comments/522630/view.html
If you found this answer helpful, you ought to mark it as answered so others that have the same question can tell that this question was answered.Fri, 23 Aug 2013 18:10:27 GMTSajidfarooqAnswer by Sajidfarooq
http://answers.unity.com/answers/518820/view.html
If it is made of multiple small line segments, then this is how you would do it:
T = location of touch/tap.
- Iterate through each line segment.
- Find the [closest point][1] on *each* line segment to P.
- From all the closest-points, choose the one that is closest to T. Lets call it CP.
- Place your object at CP.
If you are using a mathematical curve, then you can find the closest point mathematically. The method will depend on the curve.
[1]: http://en.wikipedia.org/wiki/Distance_from_a_point_to_a_lineMon, 19 Aug 2013 08:41:37 GMTSajidfarooqComment by headkitgames
http://answers.unity.com/comments/518781/view.html
its not defined yet but it may be any of these types.Mon, 19 Aug 2013 07:57:35 GMTheadkitgamesComment by Sajidfarooq
http://answers.unity.com/comments/517062/view.html
Is it a linear curve (made of small straight lines) or true mathematical curve? If mathematical, then what type? (Bezier, cubic spline etc...)?Fri, 16 Aug 2013 20:11:03 GMTSajidfarooq