Can't tween two things at once?

FlowCanvas Forums Support Can't tween two things at once?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #2702
    elvisish
    Participant

    I’m trying to tween the rotation of the main camera that’s a child object, it’s parent is an object called Shake that just shakes with DoShakeRotate. The actual Shake parent object is shaking as evident by the transform values, but it isn’t visibly shaking until the child camera has finished tweening it’s rotation. Is there some reason it isn’t visibly shaking, even though the parent is rotating?

    #2720
    Gavalakis
    Keymaster

    Hey 🙂

    Do you use the two tween nodes one after the other, or do you make use of a “Split” node?

    If you want the tweens to happen simultaneously, you need to make use of the “Split” node so that both tweens are executed at the same time. Otherwise, if you simply connect one tween node after the other, the second node will only execute when the first one is finished.

    Please let me know if that is indeed the case.

    Thanks!

    Join us on Discord: https://discord.gg/97q2Rjh

    #2728
    elvisish
    Participant

    Actually, tween quaternion is affecting the Player camera but running from a different gameobject and DoShake is running on the Player from an event. I’m not sure if it’s even possible to split them up since they’re both running simultaneously and from separate game objects.

    #2769
    elvisish
    Participant

    Here’s the tween:

    then at the end of this graph i the same object, i invoke this:

    which happens on player:

    now the actual shake rotation is performed on a child:

    but the rotation happens first, then the shake, and I can’t understand why.

    Also, the rotation isnt performed on the same object as the shake:

    its performed on update, and I’ve got a bool that sets at the end so it only does all of that once (though the tween continues as its a co-routine i believe)

    #2777
    Gavalakis
    Keymaster

    Hello again and thanks for the details provided.

    Yes, tween nodes continue because they are coroutines.

    The reason why the Rotation is done first, is because you updating the rotation in the graph Update, while the Shake is done with a coroutine and as usual, normal Updates (eg graph updating) is done first and before Unity Coroutines update (coroutines are always updated last).

    Is it possible for you to use Tween Rotation directly, instead of using Tween Quaterion + Set Rotation in update?

    If you use Tween Rotation and Tween Shake (thus both run as coroutines) then the execution order will depend only on which node of the two was executed first. The first node to execute will also update first (since its coroutine is registered first).

    Please let me know.

    Thanks!

    Join us on Discord: https://discord.gg/97q2Rjh

    #2784
    elvisish
    Participant

    I have to use DoTween reflected instead of the extensions as they are inaccurate to positions and don’t tween to precise positions for some reason. Perhaps I should run them all in coroutines?

    #2786
    Gavalakis
    Keymaster

    Hello again,

    Hmm. Cant, you simply replace the Tween Quaternion (along with the manual setting rotation from the Update port), with a Tween Rotation? For the explained reasons in my previous post, you need to either let DOTween update the tweens (using Tween Position and Tween Rotation) within its own update loop, OR use “Tween Vector3 -> Update -> Set Position” and “Tween Quaternion -> Update -> Set Rotation” nodes for both as well, so that both update from within the graph update loop.

    This way you will ensure that both will be updated at the same update loop with an order of execution also being the same as the order of execution of the nodes.

    Join us on Discord: https://discord.gg/97q2Rjh

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.