Move to Path issue



  • Hello,

    i have an issue with object properly moving to path.

    Settings of the SplineMove component are following:

    alt text

    I set the path of the object via Playmaker SWS_SetPath action and then i use SWS_StartMovement.

    For the first time it runs, it is ok, the object goes to the first waypoint then moves through the waypoints. I stop the movement using SWS_StopMovement Playmaker action and that's all fine.

    When the time for activation of the spline movement comes again, i rearrange waypoint locations of the path on runtime, then start the movement again with SWS_StartMovement.

    However, this (and every next) time the object does not move to the path but immediately changes its position to the first waypoint.

    I noticed in the inspector that the MoveToPath field is unchecked when the object reaches the first waypoint in the first run, so i tried setting MoveToPath to true after the first run is finished, but it also immediately jumps to first waypoint and disables MoveToPath on the second run.

    Unity version: 2018.3.7
    SWS version: 5.4.4.
    Build: Windows



  • Hello,

    thank you for the detailed post.

    It is correct that MoveToPath disables itself after reaching the path. This is by design, however I can understand that an expected outcome would be vice-versa (to keep it enabled and only disable it by request).

    MoveToPath needs to be set before calling the next StartMove, since this is when a new tween is created. Could you confirm that you are setting MoveToPath before calling SWS_StartMovement, or maybe implement a small delay between both calls to be absolutely sure?



  • Hello,

    Thanks for the swift response!

    I figured it needs some time to breathe so i already tried calling StartMovement five frames after setting the MoveToPath flag to true, i'll try prolonging the delay and if that doesn't do the trick i'll document my setup and make a small frame by frame video for you to see the problem occuring.

    I've had some issues when using Playmaker actions (my own and written by others) on some other assets sometimes, so i'll also try setting the flag and calling the method manually to see how that works out.



  • Hello,

    i found the culprit. I was setting the path first then setting the moveToPath property to true instead of setting the flag to true THEN setting the path. I didn't know the order of those was important, but there you have it, you learn something new every day.

    Thanks for the help.



  • Exactly what I meant, after starting the movement MoveToPath has no effect. Glad you figured it out!



  • Hi, i've got a small appendix to the issue. The problem still occurs when i start the tween using the StartMovement action, but when i call it from code with StartMove() it works ok.

    Cheers.


Log in to reply