Simple Waypoint System (SWS) - Move objects along paths

How can I smooth the rotation of the camera when goes for the next point?

maybe this iTweenHash.Add(ā€œlooktimeā€, 4 ); will smooth the rotation of the camera.

Hey alejandro,

I think youā€™re on the right track. You could try to implement that parameter into iMoveā€™s ā€œMove()ā€ method with a public variable, something like

public class iMove : MonoBehaviour
{
   public float lookTime;
   ...

    void Move(int point)
    {
     //iTween parameters
     iTweenHash.Add("looktime", lookTime);
     ...
    }
}

As you suggested, with a large value this would generate high smoothness. I also tried the ā€œlookaheadā€ parameter but didnā€™t achieved useful results. Please report how the solution above works out for you.

Really nice and simple to use ! :smile:

Is it possible to change the speed of the walkers during runtime ?

Iā€™ve tried adjusting the speed variable during runtime, but what it seems to change the speed of the walker only after they reached the next waypoint in line, is there any way to change the speed of the walker while they are walking to the next waypoint ?

@flamerx2

Thanks :slight_smile:

Unfortunately this is a limitation of iTween - It only recognizes changed variables in the moment of assigning a new iTween component, and that would be every new waypoint. To work around that you would need to set your new speed, destroy the current iTween component, then instantly attach a new one (so it takes the new speed variable as argument and continues walking).

You could use the existing methods Stop() and StartMove() to achieve that, however it is possible that you also have to wait a frame between those calls as stated in iTweenā€™s documentation: iTween for Unity by Bob Berkebile (pixelplacement)

Short example:

IEnumerator Slow()
{
   iMoveScript.speed /= 2; //set halve walker object speed
   iMoveScript.Stop(); //stop object and destroy iTween component
   yield return new WaitForEndofFrame(); //wait one frame
   iMoveScript.StartMove(); //assign new iTween component and continue walking with halve speed
}

Switch to : http://forum.unity3d.com/threads/118515-HOTween-a-fast-and-powerful-Unity-tween-engine
:smile:

JP

Actually I took a look at HOTween, but am also very pleased with iTween and happy to update SWS asap when iTween 3 is out :slight_smile:

Iā€™ve been looking around at iTween and other editors and I canā€™t seem to find an easy way to make paths that are relative to the object that will move on it. Does sws do this?

Hi Jaloper,

I think I donā€™t quite understand your question. Paths are created and placed in world space, they and their waypoints are gameobjects which can be moved at runtime - Your walker objects, that will move on them, will update their (next) waypoint positions each new waypoint. Do you want to parent the paths to the walker objects and move them both, or could you explain in more detail what you are trying to achieve?

Baroni, Will your script allow multiple animations? From what I can tell with the solider I see an idle and walk animation, but is it possible to have a different animation play at each way-point when it is on a delay? Iā€™m trying to find an easier way to do simple cut scenes, and this seems perfect!

@msken

Thanks for your interest! Yes, a different animation per waypoint is possible, but not implemented for the ease of use.
Actually I use an array for defining the delay value per waypoint - an extra array for setting the animation per waypoint would only be an addition to this, the code is already there.
I would be happy to provide you hints and example codes once you told me your decision :slight_smile:

At $10 how can I refuse? LOL thanks Baroni, purchase coming soon!

Yeah parenting the path to my object and moving them both is what I want to do. Is this possible in iTween? Or is that a feature of sws?

Alright, I tested some functionality of iTween and mixed it with SWS.
So far, here is my result. (The path moves to the right over 10 seconds)
Is this demonstration near your issue?
Seems like thatā€™s possible with iTween - but itā€™s not integrated nor battle tested with SWS yet and therefore misses some of its basic functionality. Iā€™ll see whether I can implement this over the next weekend.
Please let me know if you are interested.

Yeah that looks like what I want to do. Just moving the path as a whole. Iā€™m going to guess that you changed each of the vectors individually? I could probably just do it that way but wanted to see if there was an easier way before I dive into that.

Would you be able to post your code for that? Just curious how you accessed each node.

(Unless of course Iā€™m completely wrong in how you did that :hushed:)

Each waypoint is a gameobject, parented to a path gameobject. I moved the whole path object with one iTween.MoveTo call.

I canā€™t post the code here, because it is based on SWS and even if itā€™s cheap, itā€™s for sale :wink:
But, all waypoints of a path are stored and accessed via a Transform array.

Oh okay. So each waypoint is a gameObject that can be parented.

Sounds like SWS is something I will invest in. Thanks!

Hi Baroni,

I want to ask a simple question. Based on my itween experience, speed is not constant along the path even you set the easetype to linear. If you need constant speed you have to place the path points to the even distances.

Does SWS solve this problem ? In every single point on the path containing many points speed is the same ?

Thanks a lot.

Hi alperozer,

yes, it does! SWS is based on waypoints and straight paths, it provides you with a speed or time value to move your objects constantly between those waypoints. iTweenā€™s lack of linear easetypes on a path was the basic idea for creating SWSā€¦ right now only straight paths are implemented, but I would like to implement curved paths within a future updateā€¦

Greetings

Thanks for the reply (:

Iā€™ve tried using the Stop() and StartMove(), however, what happens is that the walker objects stop on their current position and starts moving from their beginning with the new speed variable that I set, is there any way to make them move from where they left off ?