tween.fullposition - Vector3 instead of time position?

  • I have a several objects and each object has its own path.

    fullposition does not work for me because for that I need to provide time position but I need them to start moving from exactly where they are, somewhere on their paths.

    Is there a way for me to type in their current positions and start moving them from there?

    movetopath allows them to start from their positions but then move to the start point of path so that doesn't work.

    I need them to start from their current positions on path like, in the middle of path.

    Dotween's FROM looks like it does what I need but not sure if I can use it with SWS.


  • If the fullPosition value is unknown i.e. the tween has not started yet, you would set the "startPoint" value on the movement script to the next waypoint index and keep moveToStart checked. Then it doesn't move to the beginning of the path, but to the target waypoint.

    In order to dynamically find out which waypoint is the next, you could loop over the path's waypoint array and do a distance check. On bezier paths you can even use the points between waypoints, making the gap smaller and less noticeable.

    Unfortunately there is no Vector3 API in DOTween.

  • The thing is, all objects being placed on path do not fall on waypoints. They're placed between waypoints and they need to start moving from their positions.
    I'm surprised this isn't easily done anyhow if it isn't possible then I would have to create a bunch of (15+) paths and set the start point of every path for every object where they are at but I just tested creating lots of paths and ran them all together, it lags like crazy... Hmmm

  • The thing is, all objects being placed on path do not fall on waypoints. They're placed between waypoints and they need to start moving from their positions.

    As I mentioned, that's what the startPoint variable was designed for. It is "easily done".

    You can test it out in the example scenes. Select a movement script on a path with multiple waypoints. Enter "1" as the startPoint. Keep "moveToPath" checked. The object will start at the current position but move directly to the second waypoint.

    You have even more control on bezier paths.

  • @Baroni Ahhh I thought you meant objects can only start moving from exactly where waypoints are at. So, I should check which waypoint each object has passed by and set their start point = lastwaypoint + 1.

    One issue tho. I'm moving a tons of objects with PathSpawner class and most callback methods and other stuff that come with Dotween are useless when you do that because everything is based on the very front object for example, I need to check whether each object has completed but it only detects whether the very front object has completed and the end.
    I would need to use events and I would get the same issue. Because all objects use the same splineMove, I won't be able to detect each object's whereabouts by using events..

  • I'm not sure what I could help you with? Each movement script has its own tween, so you can definitely check that for completion. There is no "front object" in SWS and I guess that is based on your custom implementation.

  • @Baroni No I tested it. Dotween's callback methods such as OnCompletion etc are useless when you choose to go with grouped objects like PathSpawner for example(1 path, multiple objects) because as soon as the first object in the group hits the last waypoint, OnCompletion will be called even though it hasn't really completed (let's say, 5 more objects still behind)

    But that's fine I found some other way. Thanks.

Log in to reply