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 - juaxix

Pages: [1]
1
DOTween & DOTween Pro / Position flickering
« on: March 22, 2016, 01:27:26 AM »
Hi, I have a three part animation, in the first one the code creates a coin and then moves it from a position to another in global coordinates:
Code: [Select]
           GameObject gCoin = GameObject.Instantiate(
                prefabCoinGO, starts[j].position + Vector3.up*2.5f, starts[j].rotation
            ) as GameObject;
            Transform tCoin = gCoin.GetComponent<Transform>();
            Tween twCoin    = tCoin.DOMove(ends[j].position + Vector3.up*2.5f, timeToTravelCoin)
                .OnComplete(() =>
                {
                    RemoveCoin(gCoin);
                })
            ;

the second and third part, are two more animations but in local space, if i do those with this approach:
Code: [Select]
            float t = Time.time;
            twCoin.OnUpdate(() =>
                {
//I tried with a tCoin.Translate(...,Space.Self) too ,same result
                    Vector3 lPos = tCoin.localPosition;
                    tCoin.localPosition = Vector3.Lerp(
                        lPos,
                        lPos + Vector3.up * Mathf.Sin(
                          Mathf.PI * 100 * Time.deltaTime * (Time.time - t)
                        )*4
                    , Time.deltaTime*10);
                    tCoin.Rotate(Vector3.up * Time.deltaTime * Mathf.PI * 60);
                })
            ;

there are some of the coins that flickers in position, jumping with bad Y coordinates, maybe because it crosses the 0,0,0 point to another axis.

But, if i do this:
Code: [Select]
            tCoin.DOLocalMoveY(-0.23f, 0.6f).SetLoops(-1, LoopType.Yoyo)
                .SetEase(Ease.InOutSine);
            tCoin.DORotate(Vector3.up * 360f, 3f, RotateMode.FastBeyond360)
                .SetLoops(-1, LoopType.Restart).SetEase(Ease.OutSine);
it works perfectly, what if i want to use OnUpdate(), does it keep a good track of the localposition or should i change dotween update for fixedupdate?

2
Hello my friend, I'm trying to understand what it's new in Unity 5.3.1 because now I can't compile the project in Visual Studio.This is the error:
Code: [Select]
DOTweenAnimation.cs(9,19,9,21): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)

do you know how to fix this error?

3
Hi, I've some DOTweenPath components in gameobjects and I would like to play them in a sequence, can i use this?

Code: [Select]
sequence.Append(path.tween);

path is my DOTweenPath component reference.
Do I need to do this before use it? (i'm going to reuse it so i switch off the autokill and autoplay buttons in editor).
Code: [Select]
path.DOPause();
path.DORestart();

because i have this error if i try to do that:
Code: [Select]

Unhandled Exception: System.ArgumentException: Key duplication when adding: Void DORestart(Boolean)

  at System.Collections.Hashtable.PutImpl (System.Object key, System.Object value, Boolean overwrite) [0x00000] in <filename unknown>:0

  at System.Collections.Hashtable.Add (System.Object key, System.Object value) [0x00000] in <filename unknown>:0

  at Mono.CSharp.MethodGroupExpr.OverloadResolve (Mono.CSharp.ResolveContext ec, Mono.CSharp.Arguments& Arguments, Boolean may_fail, Location loc) [0x00000] in <filename unknown>:0

  at Mono.CSharp.Invocation.DoResolveOverload (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0

  at Mono.CSharp.Invocation.DoResolve (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0

  at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec, ResolveFlags flags) [0x00000] in <filename unknown>:0

  at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0

  at Mono.CSharp.ExpressionStatement.ResolveStatement (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0

  at Mono.CSharp.StatementExpression.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0

  at Mono.CSharp.Block.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0

  at Mono.CSharp.If.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0

  at Mono.CSharp.Block.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0

  at Mono.CSharp.Block.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0

  at Mono.CSharp.Block.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0

  at Mono.CSharp.ToplevelBlock.Resolve (Mono.CSharp.FlowBranching parent, Mono.CSharp.BlockContext rc, Mono.CSharp.ParametersCompiled ip, IMethodData md) [0x00000] in <filename unknown>:0

Internal compiler error at Assets/Scripts/GameController.cs(594,10):: exception caught while emitting MethodBuilder [GameController::getPerfectShotRepresentation]


Can I modify the latest point of the path and re-evaluate it before play?
something like...
Code: [Select]
path.GetDrawPoints()[path.GetDrawPoints().Length - 1].Set(ballDestiny.x, ballDestiny.y, ballDestiny.z);

4
DOTween & DOTween Pro / Problem with multiple OnComplete functions
« on: November 23, 2015, 10:57:03 AM »
I'm having an issue with OnComplete in Tweens (not sequences).
When I use .OnComplete function and a DoVirtual.DelayedCall inside the function, this is delayedcall never happen.
I think it must be something related to a number of limits in calls ,like a stack limit.
Can you confirm this please?

example:
transform.DOMoveX(2f, 1f).OnComplete(() => { DOVirtual.DelayedCall(1f, () => { transform.DOMoveX(0f, 1f).OnComplete(() => { Debug.Log("Position 0"); }); });  });

that works perfectly but there is some cases ,more complicated , when the delayedcall is not working, when the amount of subsequent calls increases.

Pages: [1]