*

par

  • ***
  • 9
    • View Profile
DOPath callback on reaching each waypoint?
« 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

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: DOPath callback on reaching each waypoint?
« Reply #1 on: January 09, 2016, 06:57:13 PM »
Hi,

Absolutely, check out the OnWaypointChange callback ;)

Cheers,
Daniele

*

par

  • ***
  • 9
    • View Profile
Re: DOPath callback on reaching each waypoint?
« Reply #2 on: January 09, 2016, 06:59:05 PM »
Well crap, how did I miss that?  I apologize and thank you!

PAR

*

par

  • ***
  • 9
    • View Profile
Re: DOPath callback on reaching each waypoint?
« Reply #3 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

*

par

  • ***
  • 9
    • View Profile
Re: DOPath callback on reaching each waypoint?
« Reply #4 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

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: DOPath callback on reaching each waypoint?
« Reply #5 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