x


Make Character move along a curved path at a constant speed

Im trying to make my 2.5D platformer a little more interesting my using curved paths instead of plain straight ones and ive managed to do that using iTween but the character slows down way too much when the curve is steep. I make the character move by dividing speed by the path length * 100 and then adding that to his existing path percentage. I then send it as a message to the following script which is attached to a separate object so that i can rotate the char without the camera but still have the camera rotate with the path

 void Update () {
         Rotate();
     }
     public void SetLocal(float dist){
         pathDist = dist;
     }
     void Rotate() {
         iTween.LookUpdate(gameObject, iTween.PointOnPath(iTweenPath.GetPath("Section1 Path"),pathDist + 0.01f),0.001f);
         iTween.PutOnPath(gameObject,iTweenPath.GetPath("Section1 Path"), pathDist);
     }
more ▼

asked Apr 18, 2013 at 09:52 AM

ygman gravatar image

ygman
1 3 2 2

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2569
x593
x374
x350

asked: Apr 18, 2013 at 09:52 AM

Seen: 709 times

Last Updated: Apr 18, 2013 at 09:52 AM