Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - princemoonrise

Pages: [1]
1
DOTween & DOTween Pro / ID field in new version?
« on: April 24, 2016, 11:29:23 AM »
Hello again.. I was wondering what the new ID field is for in DOTween Path?  Will this allow us to have multiple Tweens with different ID's per gameobject? by having multiple components with different ID's?  (I recall seeing it said this wasn't possible before?)  If not, what is the field used for?  Thank you!  :)

Edit:  Saw the answer on the most recent thread... but I suppose I can use this to ask another question:

What happens if I give tweens the same ID?  Will calling Play cause all the tweens with that ID to play?

2
DOTween & DOTween Pro / Is DOTween Path relative movement possible?
« on: April 11, 2016, 12:58:12 AM »
Hello again.  I was wondering if it were possible to have a gameobject moving on a DOTween path move relative to its own position instead of world coordinates?  If my understanding is correct, is the "Relative" option in the Path Editor only applicable to editing the tween and does not apply to when the tween is actually used?

When I start a tween, the object always pops/teleports to waypoint 1's world coordinates when it begins.   Additionally, if a tween is in progress and something happens like a physics force to an object, it will pop back to the waypoint's world position which does not look good.  I've tried "Local Movement" but it does not seem to fix this.  For instance if I make waypoint 1 be (0, 40, 0), can I make the object just move to y 40 from wherever the gameobject is (treating the gameobject as (0, 0, 0), rather than teleport to (0, 40, 0) when the path is started?  If an object's position changes between one waypoint to the next, can it smooth it out and re-plot the next waypoint accordingly instead of popping?  I know I can probably just use DOMove for simple movement but Path patterns allow so much more.  I apologize if I may not understand very well how it works.

Perhaps a solution can be brute-forced by having the waypoint values offset based on the gameobject's position when the tween is started or when a waypoint is reached, but I have a feeling that there is a built-in or correct way to do this that I have not found.  Please advise.  Again, thank you very much for your tool.

3
Last question I asked wasn't stated clearly so I'll try again.

I cannot find any documentation on how to use OnWaypointChange in conjunction with the DOTween Pro Path / Visual editor.  Events such as OnComplete have have boxes in the inspector that can be used to trigger functions in scripts, but I don't see that sort of functionality for the waypoints.  I tried to use OnWaypointChange in a script but couldn't get it to do anything with the path waypoints in the editor/inspector (does it only work with ones that are specified in code?).

Can someone provide an example of how to use OnWaypointChange in a way that can reference the waypoints I am using in the DOTween Pro Path Visual Editor in a script?

I'm really stuck so some insight would be greatly appreciated, thanks.


4
Hello again.  I am trying to figure out the syntax for doing a callback when using OnWaypointChange.  Reading the documentation it looks like I need to supply "waypoints" which I know is a Vector3 array, but I want to use the values that are in the DOTween Path I've created in the pro editor.  I've tried to figure out how to do this for hours and the lack of examples has me stuck, and I'm not even sure if I'm close.  Please advise; here's my non working code:

Code: [Select]
private Vector3[] waypoints;

void Start ()
{
Tween path = GetComponent<DOTweenPath>().GetTween();
waypoints = path.PathGetDrawPoints;
transform.DOPath(waypoints, 1).OnWaypointChange(MyCallback);
}

For awhile it seemed I was getting closer, but I think it needed the array length and PathGetDrawPoints.Length wasn't working for it.

Ultimately I actually don't care about the waypoints array as long as I can run the path tween I made in the editor, and can do my callback when the waypoint change is made; if there is a more direct solution that would be fine too.

Would it be possible to add the waypoint callbacks to the Pro Editor/Inspector in the future, similar to how I can do them for OnComplete, OnPlay etc?

5
Hello.  I have attempted to implement Flash SetEase for DOColor for a couple of different situations, but in both cases, problems occur if it is started again when it is already in progress.

In my first case, I attempted to make an enemy flash white briefly upon being hit, by changing the material renderer color.  If it is hit twice in a row, the object will permanently stay white and never go back to the original color.

In the second case, I tried to make an outline in the UI blink for a few moments when health is restored.  However if it happens while the flashing is already activated, the flash rate will appear to be on white twice as much, which is expected.  However after the flashing stops, the next time the flashing is activated it will retain the undesired double white period, and the problem can be repeated until it will only appear as solid white with no flashing.

The code used is below, it is fairly straightforward.

Code: [Select]
Case 1:
rend.material.DOColor(Color.white, 0.02f).SetEase(Ease.InFlash, 4, 0);

Case 2:
Color whiteopaque = new Color32(255,255,255,255);
Text.GetComponent<Outline>().DOColor(whiteopaque, 1.6f).SetEase(Ease.InFlash, 28, 0);


I thought of putting a bool there to prevent the flash from reactivating, that would reset after OnComplete, but I want a new activation to reset the flashing duration instead, so to do that I had to use a coroutine instead of the SetEase to get the functionality I want.

However, I was wondering if you have any suggestions or if DoTween has any built in functionality to prevent the double flashing / stuck white problem, or a way of adding to the timer that I am not aware of.  I would like to use DoTween if it is possible!  Thank you very much for any advice!

6
I am trying to do a callback from OnComplete, when using a DOTween Path.  While I was able to get it working by using the OnComplete tab from the inspector and placing the prefab in the object select box, I also wanted to be able to call it from code.

I was able to get the path to activate by using DOPlay, but it seems I cannot get the syntax right for the callback (I am very new to C#/Unity so please bear with me!);  could someone suggest the proper syntax for this?:
Code: [Select]
GetComponent<DOTweenPath>().DOPlay().OnComplete(MyCallback);
Thank you for your help!


Pages: [1]