- Home /
iTween PointOnPath
Hi guys,
I'm trying to get the 3d position along an iTween path however when I use the PointOnPath function its returning huge irrelevant numbers far outside the world im editing e.g.-5.597703E+08 but if i put a box on the spline and move it using the MoveTo func it moves correctly along the spline and I can get a proper position out of it.
Am I using the function incorrectly? I assume percentage actually means 0.0f is the start of the path and 100.0f the end.
Heres my code:
Update()
{
var mPathPercentage:float = 0.0f;
var tempPoint :Vector3 = iTween.PointOnPath(iTween.GetPath("racingSpline"), mPathPercentage);
Debug.Log(tempPoint.z);
mPathPercentage+= 0.05f;
}
anybody got any ideas? thanks for any help! Gringo
Answer by cupsster · Mar 11, 2012 at 02:56 PM
Percentage must be provided in 0-1 range so you would like to divide your percentage by 100.
Update()
{
var mPathPercentage:float = 0.0f;
var tempPoint :Vector3 = iTween.PointOnPath(iTween.GetPath("racingSpline"), mPathPercentage/100);
Debug.Log(tempPoint.z);
mPathPercentage+= 0.05f;
}
Answer by smoggach · Apr 25, 2014 at 08:57 PM
Update is called every frame. PointOnPath accepts a percentage value between 0 and 1. your mPathPercentage variable reaches 1 pretty much immediately after you start.
Your answer
Follow this Question
Related Questions
iTween ColorTo/ColorFrom repeating between many colors in iOS 2 Answers
iOS slow performance only first time 0 Answers
Raycast Hit not working 0 Answers
UI Button/iTween issue on iOS build 0 Answers