Search Unity

Simple Waypoint System (SWS) - Move objects along paths

Discussion in 'Assets and Asset Store' started by Baroni, Dec 10, 2011.

  1. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Right, sorry. I meant global transitions.
     
  2. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    I'm pleased to announce that version 4.0 has been released on the stores!

    More than a few weeks in full-time have gone into this update, with the new addition of paths for NavMesh agents and support for Mecanim, besides a major overhaul of scenes, documentation and base components. Consider this as a new product! Due to that fact, please note that this version is not backwards compatible. It uses features of Unity 4.2 and 4.3 and was submitted with Unity 4.3.3. Existing users should read the new documentation for further info about new components.

    New Features:
    - NavMesh Agent movement script added
    - Mecanim Animator Controller support
    - Rewrite of custom inspectors to reveal context relevant variables
    - Waypoint Manager 2D/3D mode auto detection
    - Bezier paths now inherit from standard paths to be interchangeable
    - Recreated example scenes with more samples
    - Restructure of project and scripts to be more modular
    - Added all base scripts to namespace to get rid of conflicts
    - Rewrite of documentation including quick start
    - Scripting Reference generated
    - Various enhancements and fixes
    - HOTween updated to 1.3.000

    Changes:
    - renamed hoMove, hoMoveMinimal to splineMove and minimalMove
    - iTween and iMove has been removed from the package
    - MoveRenderer has been removed and replaced with PathRenderer
    - too many smaller changes to list them here

    Please try the new web player (in the first post) and let me know what you think. On this occasion, I would like to thank you all for your ongoing support over the last weeks, months and years. We have come a long way with this product, and our journey doesn't end here. If you haven't already done so, please write a short review on the Asset Store. Thanks again!
     
  3. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Well done!!!. Seem another product. :cool:
     
  4. ChrisMaster

    ChrisMaster

    Joined:
    Dec 27, 2013
    Posts:
    87
    Good job!

    ps. Did you fixed micro delays on hoMove?
     
  5. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Thanks ZJP and ChrisMaster.

    Upgrading to HOTween 1.3.000 made it slightly better, but they're still happening on splineMove (hoMove). I've found out that this isn't necessarily related to delays or messages, as small delays sometimes happen on minimalMove too (in some cases). It could be that the problem lies in HOTween, the way SWS creates tweens or Unity itself (coroutines/fixed update). I'll have to investigate this more to be able to fix it.
     
  6. javdog

    javdog

    Joined:
    Dec 29, 2013
    Posts:
    7
    Just purchased and found it just as advertised, one thing I could use some help with though. I have several models that have the Z direction not pointing toward the front of the vehicle, how can I get SWS to use a different axis as the forward direction as I have some vehicle with the Z pointing toward the back or out the roof? Thanks!
     
  7. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Hey javdog, thank you for your purchase.

    You can make use of a second gameobject to adjust the rotation. Create a new gameobject and attach the movement script to it, then make your model a child of the new gameobject. The movement script will only move the parent, so you are free to rotate the child how you want it to be.
     
  8. javdog

    javdog

    Joined:
    Dec 29, 2013
    Posts:
    7
    Thanks so much! I've got my first multiple model waypoint animations done in minutes! So I have my models correctly oriented, but any that I have to do this with spawn halfway thru the terrain even after I move the object or the child higher on the Y, I must be missing something.
     
  9. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    Glad to see updates to this asset I have had for some time now!
     
  10. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    That sounds like the common "animation snapping to origin" issue every Unity developer faces in the first weeks :) There are quite a few topics about this already, e.g. here or here or here. Basically you have to check your model animation, zero out the childs position and only move the parent gameobject in Unity.

    Thank you for still using it!
     
  11. javdog

    javdog

    Joined:
    Dec 29, 2013
    Posts:
    7
    Just wanted to say thanks for being professional and patient. You have no idea how many publishers on here are rude or don't even want to support their own stuff. This is a 5-Star tool and worth every penny. I'll be sure to review and rate highly. Wish all the other tools in the asset store were as plug and play as Simple Waypoints.
    Best,
    AJ
     
  12. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    That's a real compliment right there, thank you so much! It is nice to hear that you found value in our asset. I enjoyed reading your post :)
     
  13. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    Baroni I need advice about SWS and the connection of waypoints, and I feel a picture says a lot for this problem:

    $PathConnectionExample.png

    See how there are several path sections here, one coming in from the right (path1), which connects at its end on the points where path2 and path3 start, which those branch out in a network of waypoints representing the possible directions an AI driver can select to go in. I need a good method of having paths which branch out like this, linking separate paths at begin and end points, allowing me to use logic to switch the ai while using a homove (bezier/spline in newest update??) component. I know this is not necessarily what SWS had been designed for, but I hope you have some suggestions, to help keep the movement going like a train track you know, where vehicles can have switches between alternative paths along a one-way sort of network of waypoints, which all use a closed loop format

    I hope that all makes sense and you have some idea's of what I should do to best use SWS in this format!
     
  14. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Hey Reptile,

    I think a combination of messages and scripts could work well here. Let's say you have this script attached to the last waypoint of path1:

    Code (csharp):
    1. public class Seperation : MonoBehaviour
    2. {
    3.     public string defaultPath; //e.g. path2
    4.     public string alternativePath; //e.g. path3
    5.  
    6.     public string GetNextPathName()
    7.     {
    8.         //your logic to determine the next path
    9.         if(...)
    10.             return alternativePath;
    11.         else
    12.             return defaultPath;
    13.     }
    14. }
    This script should return the next path at the end of path1. Now we have to somehow call the script when your object reaches the last waypoint of path1. You could do this with messages. For that, we need another script attached to the moving object with the splineMove script:

    Code (csharp):
    1. public class SeparationLogic : MonoBehaviour
    2.     {
    3.         private splineMove spline;
    4.  
    5.         void Start()
    6.         {
    7.             //get movement script reference
    8.             spline = GetComponent<splineMove>();
    9.             //add a message at runtime
    10.             SetMessage();
    11.         }
    12.  
    13.  
    14.         void SetMessage()
    15.         {
    16.             //get messages reference of the movement script
    17.             Messages messages = spline.messages;
    18.             //clear previous messages
    19.             messages.list.Clear();
    20.            
    21.             //get message slot at the last waypoint of the path
    22.             int pathLength = spline.pathContainer.waypoints.Length - 1;
    23.             MessageOptions opt = messages.GetMessageOption(pathLength);
    24.             //insert message to call our method on this script
    25.             opt.message.Add("SetNextPath");
    26.             //we want to pass in a value of type object,
    27.             //i.e. the gameobject with the separation script on it
    28.             opt.type.Add(MessageOptions.ValueType.Object);
    29.             //the object should be the last waypoint of our current path
    30.             opt.obj.Add(spline.pathContainer.waypoints[pathLength].gameObject);
    31.  
    32.             //fill remaining lists and set up message
    33.             messages.FillOptionWithValues(opt);
    34.         }
    35.  
    36.  
    37.         //will be called at the last waypoint with its gameobject
    38.         public void SetNextPath(Object obj)
    39.         {
    40.             //get the next path name from the separation script
    41.             GameObject gameObj = (GameObject)obj as GameObject;
    42.             string nextPath = gameObj.GetComponent<Separation>().GetNextPath();
    43.             //set it, start following new path
    44.             spline.SetPath(WaypointManager.Paths[nextPath]);
    45.             //and do the same thing again at the end of this path
    46.             SetMessage();
    47.         }
    48.     }
    To summarize, the SeparationLogic script on your moving object always adds a new message at the last waypoint of each path. It then looks up the Separation script attached to the waypoint and sets the next path, depending on your logic in there. Hopefully I've commented it well enough, feel free to ask :)
     
  15. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    Awesome answer, I'll be experimenting later today, and if I get stuck I'll come back here!

    EDIT oh bummer tried creating the "SeparationLogic.cs" script. Throws "The type or namespace name 'splineMove' could not be found (are you missing a using directive..." error.

    Hmm does it have anything to do with splineMove.cs being in SWS namespace?

    EDIT2: ok added "Using SWS;" and got rid of that ;)

    EDIT3: well now it seems to work well as far as switching to path the splineMove has selected, but the problem I am getting now is that the object stops moving on the first waypoint of the new selected path, rather than continuing to travel along the path as if they were connected. I tried adding spline.StartMove() after changing paths, but that makes no difference for me. I must be doing something wrong?
     
    Last edited: Apr 15, 2014
  16. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    SetPath() calls StartMove() internally, so there's no need to make an extra call. Have you checked that SetPath or StartMove are actually being called (once)?
     
  17. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    SetPath gets called within splineMove, as I can place a debug log in there and it reports in the console that it is running from the SeparationLogic.SetNextPath() method.

    Hmm I will keep messing with it, but you could use this test scene to try and see if you can figure it out, this is just a archive of a slimmed down example project with a box following a path that uses the same scripts you provided before:

    https://www.dropbox.com/s/hq64wbq811crjug/ExampleProject.rar (~11.09MB)

    Of course I have not included SWS itself and you will have to put the SWS folder into the project before opening it for things to work properly.
     
    Last edited: Apr 16, 2014
  18. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Thanks for the repro! I've figured out you should comment out the line

    Code (csharp):
    1. StartCoroutine(ReachedEnd());
    at the end of the NextWaypoint() method in splineMove. This method interferes with the separation logic and destroys the tween. Other splineMove scripts won't work anymore though, so you could also comment out or customize the code in ReachedEnd() instead.
     
  19. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    Hmm I will have to take some time to understand these methods first I suppose. I want many splineMove scripts active at any given time so that would be an issue for me if it effects other splineMove components. I will see what I can come up with.

    EDIT: ok came up with something that worked.... a little bit haha

    changed this part of the case for "none" in splineMove.cs:

    Code (csharp):
    1. Debug.Log("running multiPath towards: " + pathContainer);
    2.                     if (tween != null)
    3.                         tween.Kill();
    4.                     tween = null;
    5.                     CreateTween(); // prepare tween for next path
    6.                     InitWaypoints(); // reinitialize the wpPos variable
    7.                     break;
    which lets me keep on moving onto the next waypoints set, but because I hadnt set more up, it then bugs out... let me setup a few closed loop system and I bet that works as a solution to my problem!

    EDIT new example project attached (same link as before I think) and this time I have it working to go around two separate paths branching off the first. problem now is that it throws exceptions about the "execution" of the messages script. Here take a look and see if you can get me sorted out on that area, and we should have a good way to do it set up, since it already works!

    https://www.dropbox.com/s/hq64wbq811crjug/ExampleProject.rar (~11.12MB)

    Oh one more thing, that exception is only if there are more waypoints on the old path than the new path, so it's trying to call methods or something in the old path after the switch - what should I do?
     
    Last edited: Apr 16, 2014
  20. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    This one took me a while.. since we are clearing the messages on every path change, the message script tries to loop into non-existent messages. If you open up the Messages.cs script, scroll down to line 96 and replace

    Code (csharp):
    1. for (int i = 0; i < list[index].message.Count; i++)
    with

    Code (csharp):
    1. int count = list[index].message.Count;
    2. for (int i = 0; i < count; i++)
    3. {
    4.      if(list.Count - 1 < index)
    5.      return;
    The code below that (the other if-check etc.) stays the same. This is a really hacky way of cancelling the loop, but it doesn't throw that null reference at least. Oh and you don't have to add InitWaypoints() and CreateTween() in the loop type none, it does work without them too.
     
  21. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    Thanks Baroni for the continued support! Makes it worth every penny to buy your assets.

    Anyway ok sounds good to me, I will test this out here in an hour or two, and hopefully everything goes ok, and you won't get any new questions from me - today - haha.
     
  22. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Keep them coming, I'll answer them with a slight delay after my beauty sleep ;)
     
  23. javdog

    javdog

    Joined:
    Dec 29, 2013
    Posts:
    7
    Could you direct to any tuts or info on using SWS with Playmaker? TIA
     
  24. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    There's a separate unitypackage included under SWS > Plugins > PlayMaker. It contains many custom actions, a documentation pdf as well as a sample scene that showcases them.
     
  25. Fritsl

    Fritsl

    Joined:
    Mar 10, 2013
    Posts:
    211
    Wow - I just found out how you have implemented PlayMaker support. Very, very nice!!

    With the chance of asking a question already answered in this mile long tread - sorry if this is a repeater, I have searched :)

    Here's an early 'proof of concept' of my game in development:



    As you can see, it's as such a 2D platformer, but this is not visible to the average player. But in fact there's only 2 directions to move in at any time: Forward or backwards on a spline. (Making it very nice on Mobile, as it is designed to)

    Now, since I saw how SWS has evolved, I'm considering redoing everything and using SWS for the splines leading my character and all enemies through the game. In the video you do not see characters also walking on the spline, but in the real game there are a ton of little funny characters all running on the same spline, jumping over and under, attacking etc - all on the spline curving through a landscape, with a lot of platforms etc.

    I need to use character controllers: Both with move and with simple move. Or 'pushed' capsule colliders.

    Never exact positions:

    It is essential that the waypoint system is not forcing my characters through each other when they meet, and it will be way too CPU intensive (create a ton of GC.Collect issues) if I am checking everything every frame and 100% controlling backwards / forward through SWS. This is where Character controllers (or capsule colliders pushed) comes in very handy!

    So, my question is: How would you / is it possible to use SWS to 'gently push' character controllers like I have done with my homemade system shown in the video? As opposed to 'set an exact position'?

    Thanks :)
     
  26. Fritsl

    Fritsl

    Joined:
    Mar 10, 2013
    Posts:
    211
    Here's a video showing the needed functionality of only 'pushing' characters as they meet each other: They are all moving to a spline, but only pushed - is this possible with SWS? Thanks :)



    As I'm playing to demo this, I am never stopping the character, only changing direction and pressing jump - the system is stopping the characters and even moving them slight out of path when they are 'under pressure', and never forces them through - which is my main question: Is this possible to set up with SWS without checking every frame if we should stop - for instance by using simple.move?
     
    Last edited: Apr 23, 2014
  27. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Thanks for revisiting SWS, I just read your pm. You have a nice game there! I like the simple, kind of blocky graphics.

    I watched both videos, and it would be very difficult to achieve your results without rewriting SWS. The movement scripts in SWS are still meant for automated movement of enemies or platforms, not that much for player movement or platformers. As they are based on pre-defined tweens (or NavMesh since v4), manipulating the tween's position with character controllers / collisions won't work as it stands.
     
  28. Fritsl

    Fritsl

    Joined:
    Mar 10, 2013
    Posts:
    211
    OK, thanks!

    I do not think it'd be _that_ difficult though. Since I did this myself with a couple of 'ninja tricks' I developed - PM me if you are interested in collaborating on a simple system to add on making this entirely possible out of the box, I'd be happy to help.
     
  29. itchix

    itchix

    Joined:
    Apr 14, 2014
    Posts:
    3
    Hi Baroni,

    First thank you for your great Asset SWS is simple awesome.
    I have one question :
    - I want to instantiate a clone every x sec and then walk on the path.
    - Fisrt I put the script to my walker prefab (Soldier Prefab) and i make an empty object (SpawnSoldier) with script which instantiate clone.
    For example when my prefab (not the clone) is between the waypoint 3 and 4, the clone will be instantiated at the position of the waypoint 3... and if it bewteen 4 and 5n it will be instantiated on 4...
    But I want that the clone begin at waypoint 0...

    It's my script SpawnSoldiers :

    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class SpawnSoldiers : MonoBehaviour {
    5.  
    6.     public Transform soldierPrefabs;
    7.     public float timeToPopup = 5.0f;
    8.     public Vector3 posSpawn;
    9.    
    10.     void FixedUpdate () {
    11.         timeToPopup -= Time.deltaTime;
    12.         if(timeToPopup < 0){
    13.             GameObject clone = Instantiate(soldierPrefabs, posSpawn, Quaternion.identity) as GameObject;
    14.             timeToPopup = 5.0f;
    15.         }
    16.     }
    17. }
    What's the problems? How can I do? Thank you for any help
     
  30. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Hi itchix,

    welcome to the forums and thanks for using SWS!

    I guess what happens is that your soldier walks in the scene, then you instantiate more clones from this soldier (in the scene). But that's not really the prefab, prefabs are located in your project folder and should not walk anywhere. Remove all soldiers from your scene and assign the prefab (from your project folder) to your SpawnSoldiers script. Let me know if this works for you!
     
  31. itchix

    itchix

    Joined:
    Apr 14, 2014
    Posts:
    3
    Thanks for your reply!

    I do what you advice to me but when I try to add the Path Container to the Spline Move Script (Wich is attach to my prefab), it doesn't want to add my path manager... It want only object from Asset nor from the scene..
     
  32. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Unity does not let you assign objects from the scene to prefabs (prefabs have to be universal, not scene-specific). In this case you have to set the path via code at the moment you are instantiating your soldiers:

    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class SpawnSoldiers : MonoBehaviour {
    5.  
    6.     public Transform soldierPrefabs;
    7.     public float timeToPopup = 5.0f;
    8.     public Vector3 posSpawn;
    9.  
    10.     void FixedUpdate () {
    11.         timeToPopup -= Time.deltaTime;
    12.         if(timeToPopup < 0){
    13.             GameObject clone = Instantiate(soldierPrefabs, posSpawn, Quaternion.identity) as GameObject;
    14.             //sets the path, enter your path name
    15.             clone.GetComponent<splineMove>().SetPath(WaypointManager.Paths["your path name here"]);
    16.             timeToPopup = 5.0f;
    17.         }
    18.     }
    19. }
    Or you could add a public variable to your script and pass that to the SetPath method, instead of entering the path name.
     
    Last edited: Apr 25, 2014
  33. itchix

    itchix

    Joined:
    Apr 14, 2014
    Posts:
    3
    I tried what you write but it seems to be a problem when I SetPath(...)

    It says me
    Code (csharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. SWS.SpawnSoldiers.FixedUpdate () (at Assets/Scripts/SpawnSoldiers.cs:20)
    II tried the two way that you give me, I don't understand why it's like that..

    Thanks for your help
     
  34. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    I don't know what you're doing in line 20 of your script, but a NullReferenceException usually means that Unity can't find the instance you are referring to. It could be that:

    - you haven't assigned the soldier prefab to your soldierPrefabs variable
    - the GetComponent call could not find the simpleMove script on your prefab (not its children)
    - the path with the path name you've specified does not exist in the scene

    Please have a look at the example scene Example5_Runtime in the SWS/Examples folder. It has a sample for instantiating walker and path prefabs at runtime (RuntimeDemo script, Example 1). If this does not help, you could also send me a small repro project at info [at] rebound-games.com.
     
  35. bizilux1

    bizilux1

    Joined:
    Jun 6, 2013
    Posts:
    151
    hey baroni,

    remember me? making bus simulator and all?... haha i've been super lazy, and i've just started wrapping things again, and wanted to finish up my traffic system...

    anyways i upgraded to recent version of SWS, and now all the gizmos for waypoints are gone?

    i remember back in january/february that each checkpoint had X,Y,Z gizmo

    http://www.rockymountainastrologer.com/Graphics/xyz.gif this...

    and now its really hard to position checkpoints because when i try to adjust it, they go into ground and all different kind of stupid things that i dont want, i need fine tuning on just 1 axis, not in 3D space...

    is it possible that you send me previous versions, from january or february?
     
  36. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Yes, you're the PlayMaker guy with the super nice review and three different movement simulations. Welcome back :)

    Unity's editor does not handle the old gizmos very well in the newer versions (Unity 4.3+). The editor gets laggy with lots of them (10+), that's why I've replaced them with the new ones. If you want to position them on one axis only, you could align your scene view to that axis, then they won't consider at least one other axis.
     
  37. bizilux1

    bizilux1

    Joined:
    Jun 6, 2013
    Posts:
    151
    yes thats right :)

    ok that will have to do for now i guess... although my computer is pretty good so performance shouldnt be that much of a problem,

    got another problem though... hoMove was deleted in new version? i believe thats what the script was called... so yeh now a lot of my AI system aint working anymore :/

    will need to rework it again i guess with splinemove?
     
  38. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Mine is a gaming pc with pretty good hardware too, but the Unity editor skips frames regardless with the other handles.

    Yes, sorry. I've stated that the new version is not backwards compatible anywhere I possibly could. There have been major structural changes on all scripts, so keeping the script names did not make much sense.
     
  39. bizilux1

    bizilux1

    Joined:
    Jun 6, 2013
    Posts:
    151
    yea my motto is, if it aint broken dont upgrade it :D

    that goes for unity too, since new releases are always a bit buggy

    no idea what got into me to upgrade it without making backup first :)


    one more question... is there noticeable performance difference on mobile phones, between spline move and minimal move? when you have like 10-20 cars on screen?

    why im asking is, because i could really use "current point" option... but if there is noticeable difference, i can do without it.
     
  40. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    minimalMove does not occupy one additional frame to execute messages or delays, so if you have very fast moving objects this would be the best choice. Otherwise there should not be a noticeable difference between splineMove and minimalMove.
     
  41. bizilux1

    bizilux1

    Joined:
    Jun 6, 2013
    Posts:
    151
    ok it seems as i will need to use bezier paths, but is there any way that i can use current point feature on bezier paths :/... because i really need that feature... i will have car spawn points across whole city, and i was planning on having really long paths. so it would be crucial that i can spawn cars in middle of existing paths

    curved paths sometimes work fine, but sometimes they are just all over the place?... as far as i am aware, this used to work better in january/february versions


    check these screenshots for example... sometimes it is really hard to get nice curved path. or impossible really...
    $problem 2.PNG $problem 3.PNG View attachment 98252
     
    Last edited: May 2, 2014
  42. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Thanks for the images. The code for spline calculations has not been touched in the latest versions of HOTween, as far as I know. I'll post a link to your post here in the thread of HOTween, maybe there's something I'm not aware of. Usually it works better with less waypoints though (try removing waypoint 30 in the last image).

    Adding a current point value to bezier paths is not feasible, because bezier paths consist of many more points than just waypoints.
     
  43. Demigiant

    Demigiant

    Joined:
    Jan 27, 2011
    Posts:
    3,242
    Hey bizilux1. I'm HOTween's developer: Baroni told me about your issue, which is pretty weird. Can you send me (or Baroni) an example project that reproduces the issue, so I can check out what's wrong?
     
  44. bizilux1

    bizilux1

    Joined:
    Jun 6, 2013
    Posts:
    151
    removing waypoint 30, gives this result


    then i made some more paths... as you can see, sometimes it works perfect, but on some turns it just messes it up


    then i made one more. you can see problem in top left.


    then i tried fixing it by dragging waypoints around a bit... it kind of works, but it is never as good as if it was automatically perfect from the start.


    i'll PM you two with this road pieces and i'll first try if i can replicate it with new project and just these road pieces and SWS installed
     
  45. Peter Hou

    Peter Hou

    Joined:
    Oct 12, 2010
    Posts:
    66
    Hi,

    We're looking into buying a waypoint solution for some simple fish animation and AI. Is it possible to change or create waypoints in runtime using SWS? An example scenario where this would be useful is if we feed the fish by dropping a piece of food into the water. I would then like to create a waypoint at the food's position to make the fish swim towards it.
     
  46. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Hi Peter,

    changing waypoints at runtime is possible if you don't have an object moving on the path. However you wouldn't want to do this... In the scenario you've described, it would be better to stop the waypoint movement when you're dropping food into the water and just let the fish move towards its position by using Unity's Vector3.MoveTowards method. After that, the fish could return to its path.
     
  47. Peter Hou

    Peter Hou

    Joined:
    Oct 12, 2010
    Posts:
    66
    Thanks for the reply, Baroni :)
    SWS also looks very flexible in the tech demo so we'll buy soon.
     
  48. RichCodes

    RichCodes

    Joined:
    Apr 3, 2013
    Posts:
    142
    Hello Baroni,
    Is this still possible to switch paths mid path?

    Great product by the way! Saved me a ton of time already so far

    *Edited to minimize size
     
    Last edited: May 15, 2014
  49. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,259
    Hi aT,

    thanks! Yes, the currentPoint variable is visible for the splineMove and navMove movement scripts. bezierMove does not allow for different starting points due to internal path calculations and minimalMove does not implement it.
     
  50. RichCodes

    RichCodes

    Joined:
    Apr 3, 2013
    Posts:
    142
    Thanks! I had been looking through bezierMove.
    No wonder I was having trouble :p