Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

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:
    2,383
    Hi @andreiagmu,

    SWS makes use of the global setting (be it update type or timescale) specified in DOTween's settings indeed, so that any tween can be configured to run before or after your game's update logic.

    This is the first time an individual setting per movement script has come up, could you please explain a use case where the global setting does not cover this? Note: navMove is not controlled by tweens/DOTween and has the default Unity update loop for NavMesh agents.
     
    andreiagmu likes this.
  2. andreiagmu

    andreiagmu

    Joined:
    Feb 20, 2014
    Posts:
    57
    Oh, I hadn't used navMove yet, I didn't know it doesn't use tweens, hehe.
    So in my suggestion, splineMove is the only relevant move.

    For now, I can use the DOTween global settings alright. I just thought of the possibility of I needing/wanting some splineMoves to run on Update, others on FixedUpdate, etc. Or I wanting some splineMoves to be TimeScale Independent, and others not, that kind of thing.
     
  3. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,383
    Sure, let me know when that happens :)
    TimeScale independent tweens are usually used in UI animations, however you wouldn't use splineMove for that but a scripted tween directly (depends on the game of course).
     
    andreiagmu likes this.
  4. martinreimer

    martinreimer

    Joined:
    Feb 21, 2018
    Posts:
    15
    @Baroni Im running Unity 2019.2.17f1 and getting null ref errors

    Steps to recreate: 1. Create waypoint manager 2. Enter path name and hit start path 3. When i hit P I receive the first error.


    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. SWS.WaypointEditor.OnSceneGUI () (at Assets/SWS/Scripts/Editor/WaypointEditor.cs:62)
    3. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <567df3e0919241ba98db88bec4c6696f>:0)
    4. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    5. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <567df3e0919241ba98db88bec4c6696f>:0)
    6. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <567df3e0919241ba98db88bec4c6696f>:0)
    7. UnityEditor.SceneView.CallOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:3292)
    8. UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2539)
    9. UnityEditor.SceneView.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2400)
    10. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <567df3e0919241ba98db88bec4c6696f>:0)
    11. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    12. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <567df3e0919241ba98db88bec4c6696f>:0)
    13. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <567df3e0919241ba98db88bec4c6696f>:0)
    14. UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:359)
    15. UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:353)
    16. UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:329)
    17. UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect, System.Boolean floatingWindow, System.Boolean isBottomTab) (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:374)
    18. UnityEditor.DockArea.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:341)
    19. UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:298)
    20. UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:483)
    21. UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:466)
    22. UnityEngine.UIElements.KeyboardEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/Events/KeyboardEventDispatchingStrategy.cs:21)
    23. UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:280)
    24. UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:156)
    25. UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:190)
    26. UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:255)
    27. UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:78)
    28. UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
    29.  
     
    Last edited: Feb 10, 2020
  5. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,383
    @martinreimer
    Looks like a Unity bug. Did you recently upgrade? Have you tried restarting Unity and resetting the editor layout (top right corner)?

    Please use the forum on our website for further support.
     
  6. martinreimer

    martinreimer

    Joined:
    Feb 21, 2018
    Posts:
    15
    Resetting the layout resolved the issue. Thanks!
     
  7. SpyrosUn

    SpyrosUn

    Joined:
    Nov 20, 2016
    Posts:
    136
    Hi ! Would i be able to use the simple waypoint system to control a character with the mouse dynamically while playing ?

    Thanks !
     
  8. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,383
    Hey @SpyrosUn, what exactly do you mean by "control a character with the mouse"? Do you mean adjusting speed, or jumping while it moves? That would be very easy.

    I mean, if you would like to add point and click movement to your game, you wouldn't necessarily need a waypoint system - Unity's NavMesh system would work for that too. Could you define your requirement a bit more? :)
     
  9. Nikaas

    Nikaas

    Joined:
    May 30, 2013
    Posts:
    105
    Line 83 in splineMoveEditor class causes Unity to lag when a prefab with splineMove component is selected in the project hierarchy. There are similar cases in navMoveEditor and moveEditor classes.
     
  10. charith-madusanka

    charith-madusanka

    Joined:
    Feb 10, 2017
    Posts:
    5
    How can i change time to complete loop at runtime???
    @Baroni
     
  11. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,383
  12. jackvob1

    jackvob1

    Joined:
    Mar 2, 2018
    Posts:
    38
    Hello, im interested with your asset to use in one of my project for my ai waypoint in the road , i want to ask a couple question :
    1. in the image it could change path but only 2 path is it availabe to change path with 3 path ?
    2. for interaction with other object (Like other cars or traffic light) is there already script in the asset or we need to create it ourself ?

    i have a lot of question but i cant think of any right now :) i think thats it for now, Thank you
     
  13. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,383
    Hi @jackvob1,

    1. A path is a path, you can switch from one to another. It is irrelevant how many paths you have in your scene.
    2. Game specific code needs to be created by yourself. There are public methods available for most scenarios, but there is no template for vehicle simulation since this depends on your game.
     
  14. tomi-trescak

    tomi-trescak

    Joined:
    Jul 31, 2013
    Posts:
    77
    Hi, I did purchase SWS 6 years ago but no longer have access to Invoice ID so I do not know how to register for your forums. But I can show you a screenshot of my asset store.

    Anyway, my issue is that I cannot make the camera following the object on a spline path work. I use the simplest camera to follow the script from Unity API. BUT the object on the path JUDDERS horribly! The environment moves smoothly, but the object jumps back and forth.

    If I just parent the camera to the moving object it works, but the camera movements are too sharp. Thus:

    How can I make the camera follow the smoothly moving object?

    [EDIT] I made small GIF showing my issue: https://ibb.co/6WqhPxL
     
    Last edited: Aug 24, 2020
  15. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,383
    Hi @tomi-trescak,

    did you see our camera sample scene? Are you able to reproduce the issue there as well?

    A quick trick would be to set the "lookAhead" value on the movement script to something very small. It goes from 0-1, so you could try 0.02. This usually smoothes it out quite a bit.

    Regarding your lost invoice, please head over to your asset store account on the orders page. If you get the order ID, you would be able to contact Unity support for the corresponding invoice ID.
     
  16. usama-qureshi

    usama-qureshi

    Joined:
    Apr 22, 2016
    Posts:
    4
    'WaypointManager' does not contain a definition for 'Paths' ,, This error comes when SWS package imported,
    walker.GetComponent<splineMove>().SetPath(WaypointManager.Paths[path.name]);
    example2.moveRef.SetPath(WaypointManager.Paths[example2.pathName1]);

    these are the lines where this error show. Unity version 2019.2.16.
     
  17. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,383
    @usama-qureshi We do not use this forum for support. Please register on our dedicated support forum, on our website.

    Quick tip: it is likely that you have another class named "WaypointManager" in your project, not in a namespace, which is interfering.
     
  18. UDN_5c806b49-d8a0-4f67-a296-c12c91aa7396

    UDN_5c806b49-d8a0-4f67-a296-c12c91aa7396

    Joined:
    Jan 9, 2017
    Posts:
    146
    Why does using navMove momentarily stops agents on each waypoint? Why doesn't it smoothly just continues to the next waypoint without delays?
     
  19. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,383
  20. UDN_5c806b49-d8a0-4f67-a296-c12c91aa7396

    UDN_5c806b49-d8a0-4f67-a296-c12c91aa7396

    Joined:
    Jan 9, 2017
    Posts:
    146
    Nope, I'm not (but really thinking of getting a copy myself, looks neat). I'm helping my bud with some stuff for his game. He probably has the invoice.

    [code removed as per author request]

    Anyway, I did this to make it smooth.
     
    Last edited: Sep 14, 2020
  21. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,383
    As per Unity Asset Store EULA, editor extensions are licensed per seat. If you are "helping your bud", you still need a license for yourself. Please remove the code snippet you've posted. This is a public forum, it is not allowed to share snippets of our code here. We've specifically set up our own support forum for things like this - and we would really like it there!
     
    aweha likes this.
  22. i_cassell

    i_cassell

    Joined:
    Apr 6, 2019
    Posts:
    19
    When will the new version be released?
     
  23. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,383
    @i_cassell did I miss something? What exactly are you expecting in an update?
     
  24. i_cassell

    i_cassell

    Joined:
    Apr 6, 2019
    Posts:
    19
    Every thing is OK.I just want to know the RoadMap
     
  25. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,383
    Updates are submitted sporadically, depending on changed functionality in Unity versions and resulting bugs or adjustments needed. The feature request list is very short, so there is no major update planned at the moment.
     
  26. ishangill

    ishangill

    Joined:
    Nov 28, 2017
    Posts:
    5
    Hello.
    I am using SWS.
    I have a train model with 3 coaches . How can i move a train with SWS.
     
  27. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,383
    Hi @ishangill!

    The easy way would be to attach a movement script to each train wagon, with an offset, and have the update times of DOTween set to FixedUpdate. This would be done to prevent the wagons getting separated over time (the distance between them) as one movement script could execute faster than others.

    The complex way would be to only attach a movement script to the first wagon and connect others with Joints components. That requires a lot of trial and error to get right, as they are driven by physics and often do not behave as desired.

    Thank very much for your review, btw! If you have more questions, please head over to my support forum instead, since it is directed at verified customers (I can track requests and we can better share code there).
     
  28. ishangill

    ishangill

    Joined:
    Nov 28, 2017
    Posts:
    5
    Ok Thanks i will try.
     
  29. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,383
    v5.5.0
    • changed events on waypoints: UnityEvents for all waypoints in the inspector are gone, as feedback told they were difficult to maintain. Instead, three UnityEvents were added: start, change (waypoint), end. You can also listen to these events via code on the corresponding Action. Be aware that when updating, your existing events need to be re-added. See the scripting documentation for more details and event descriptions.
    • changed NavMeshAgent stoppingDistance default to 0.5 if kept at zero
    • fixed splineMove not starting to play with DOTween AutoPlay set to none
    • fixed documentation links
     
  30. Gamingbir

    Gamingbir

    Joined:
    Apr 1, 2014
    Posts:
    151
    Does it work with 2D? It should work I suppose
     
  31. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,383
    @Gamingbir Yes, it does. It auto detects the 2D mode when placing waypoints.
     
    Gamingbir likes this.
  32. LukeSilverbackgames

    LukeSilverbackgames

    Joined:
    Feb 14, 2018
    Posts:
    2
    @Baroni Is there a built-in way for me to tell a character to walk a path within a given amount of time? For example, walk this spline path and be finished it in 10 seconds.
     
  33. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,383
    @LukeSilverbackgames Yes, have a look at the "timeValue" variable in the inspector. It can either be set to a time or speed value.
     
  34. LukeSilverbackgames

    LukeSilverbackgames

    Joined:
    Feb 14, 2018
    Posts:
    2
    Gotcha. Is there a way to change the speed based on where the character is in the path? If I give the character a short amount of time to move along the path, he'll run along it. However, at the end of the path, he'll stop pretty quickly and it looks a bit unnatural. Is there a way for me to say "start to slow down at the end"?
     
  35. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,383
    You could use a custom animation curve for the full path, or change the object's speed near the last waypoint (ChangeSpeed method). As it seems you are already using SWS, please use the dedicated support forum for further questions. Thanks!
     
  36. Cannabik

    Cannabik

    Joined:
    Jan 11, 2018
    Posts:
    5
    I bought Simple Waypoint System a few hours ago and I would like to register in the support forum, but it does not allow me to create an account.

    I put all the data correctly but when I hit the register button it takes a few seconds, and a registration error message appears.
     
  37. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,383
    Hi @Cannabik, thanks for contacting me. Let's continue in private messages, could you send me your invoice number in a private DM? Thanks!
     
  38. Cannabik

    Cannabik

    Joined:
    Jan 11, 2018
    Posts:
    5
    Hi @Baroni, I just tried to register again and now it has worked. Thank you for your prompt reply!
     
  39. blastedw

    blastedw

    Joined:
    Apr 29, 2019
    Posts:
    13
    Does the script allow for rotating the game object on a secondary axis? For example, if I have a plane along a path, the plane needs to face the direction of the path and also bank accordingly.
     
  40. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,383
    Hi @blastedw, custom rotations are supported using the waypoint rotation feature. It allows you to set the exact rotation between waypoints, e.g. for planes that tilt to either side. This is also showcased in the waypoint rotation sample scene and web player.
     
unityunity