Demigiant Forum
Unity Assets => DOTween & DOTween Pro => Topic started by: editkid on August 07, 2015, 03:47:57 PM
-
Hi! Just wondering if I'm correct in this assumption. In the following scenario the second tween would override the first.
obj.DORotate(Vector3.up, 0.5F);
obj.DORotate(Vector3.right, 1);
To clarify, tween #1 goes to (0,1,0) and #2 to (1,0,0). The second tween re-specifies the Y component of the first tween as 0, effectively overriding #1's Y value of 1.
It'd be handy to be able to do these compound rotations at different speeds, although I can see how that might get tricky in terms of setting the Euler angles or Quaternion values. Can't do them for a single axis.
Or maybe I'm not understanding the correct way to make this work simultaneously. Sequences? SetRelative? DOvoodooMagicTween?
Thank you kindly! I love DOTween to bits.
-
Hi!
Tweens targeting the same property on the same target indeed overwrite each other. I create special methods for position (DOMoveX/Y/Z) which work independently, but for rotation that can't really be done (because Quaternions are the mother of all necessary evils).
The only trick you could use, would be to have a parent/child relationship, where you rotate the parent in one direction and the child in another. In that case, with two different targets, that would work.
Cheers,
Daniele
-
Thanks! As I suspected. I'm probably missing something, and apologies for the crude example, but would it be possible to do the following? If you wanted to do a hypothetical DORotateY.
Vector3 v = transform.rotation.eulerAngles;
transform.rotation = Quaternion.Euler (v.x, value, v.z);
Cheers,
Peter
-
I do exactly that with position/scale X/Y/Z tweens. But in case of Quaternions that would mess things up, because vectors are not so straightly converted into Quaternions.
Cheers,
Daniele
-
Ah yes, of course. Thank you! :)