DOTweenPath
« on: July 03, 2015, 08:42:32 PM »
Hi,
I am playing with the DoTweenPath editor extension,  but using code I can't find documentation or how to:

  • Know when a waypoint is reached
  • Path progress (seconds, from total duration or at which at waypoint)
  • Set the playhead to a specfic waypoint
  • Set the playhead to a specific time

I feel that having the source code we could understand faster and extend/customize this feature for our games.
Greensock is a good business model example where members-only features always came with the source code.
I can also see more and more asset store developers are opening their source to gather more momentum and collaborators around their products.

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: DOTweenPath
« Reply #1 on: July 04, 2015, 02:04:11 AM »
Hi,

I love Greensock, but the reason why DOTween's code is not lose scripts is tied to the fact that namespaces and the internal keyword work very differently in ActionScript and C#. I initially wanted to make DOTween as lose scripts, but a decent API would've been truly impossible (not to mention the speed of compilation and other features that a pre-compiled DLL allows).

If you're curious about DOTween's code, its open source is here. Though indeed it's missing the Pro part, which I wouldn't know how to share right now.

That said, if you want to do the stuff you wrote, you'll have to get the DOTweenPath's tween (myDOTweenPath.GetTween()) and use the open source libraries with it:

Code: [Select]
// Get the tween
tween = this.GetComponent<DOTweenPath>().GetTween();
// Add a callback to know when a waypoint is changed
tween.OnWaypointChange(WaypointChangeCallback);
// Set the playhead to a specific waypoint
tween.GotoWaypoint(2);
// Set the playhead to a specific time
tween.Goto(2);

You can find more info about those methods here.

Re: DOTweenPath
« Reply #2 on: July 06, 2015, 11:11:35 PM »
Hi Daniele,
Thanks for the quick reply!

I did not know the Tween object enough, this makes sense!

I finally did a parallel mini-sequencer that pauses the path tween and do some actions, nothing fancy but it works!
Now I see how I could bind it with specific waypoints!

Also makes sense for the compilation time, hate having to wait hours to iterate!

Cheers
- Jonathan

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: DOTweenPath
« Reply #3 on: July 06, 2015, 11:21:39 PM »
Glad you're shaping it to your own will (hope that's the right expression)!


Cheers!