Demigiant Forum

Unity Assets => DOTween & DOTween Pro => Topic started by: par on January 09, 2016, 06:27:34 PM

Title: DOPath callback on reaching each waypoint?
Post by: par on January 09, 2016, 06:27:34 PM
Is it possible to run a DOTween DOPath tween but have a callback that is... well called every time the tween hits one of the waypoints in it's array?

Thanks!

PAR
Title: Re: DOPath callback on reaching each waypoint?
Post by: Daniele on January 09, 2016, 06:57:13 PM
Hi,

Absolutely, check out the OnWaypointChange callback (http://dotween.demigiant.com/documentation.php?api=OnWaypointChange) ;)

Cheers,
Daniele
Title: Re: DOPath callback on reaching each waypoint?
Post by: par on January 09, 2016, 06:59:05 PM
Well crap, how did I miss that?  I apologize and thank you!

PAR
Title: Re: DOPath callback on reaching each waypoint?
Post by: par on January 09, 2016, 07:21:39 PM
Um... quick question on DOPath though.... It seems as if its returning to the starting position.  I was assuming that when the last waypoint was reached the tween would stop.  Is this possible w/ DOPath?  I didn't see a DoSpline type method...

PAR
Title: Re: DOPath callback on reaching each waypoint?
Post by: par on January 09, 2016, 09:04:28 PM
Hmm... and is it possible to send the tween object itself (or any other parameter) into the OnWaypointChange() method like we do the normal callback lambdas?

Thanks!

PAR
Title: Re: DOPath callback on reaching each waypoint?
Post by: Daniele on January 10, 2016, 02:08:01 AM
Hi,

You can use a lambda too with OnWaypointChange, while accepting the int parameter:
Code: [Select]
// "x" in this case represents the int parameter
...OnWaypointChange(x=> AnotherMethod(x, myTween));
// ...
// Example method
void AnotherMethod(int waypointIndex, Tween myTween) {}

About the path returning to the start, that should totally not happen. Are you using the latest version of DOTween (1.1.135)?

Cheers,
Daniele