Multiple Move Position and Rotation at the same time.
« on: October 07, 2015, 10:20:29 PM »
Hello to all,

I created a system of recording for a die's positions and rotations. (now I save these infos every 0.2 ms).
I Serialize all these informations on a XML file.
The XML file contains all positions and rotations (Quaternion).
I would play/reproduce with DOTween to play the entire movement of the dice, playing simultaneously position + rotation together.
I read that exists a sequencer Object and i read that exist two awesome API : DOMove() and DORotate().

What is the best code block to reproduce concurrently the position and rotation for every position and rotation saved in my xml file?.
Thank you very much for helping.

Regards Alessio.

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: Multiple Move Position and Rotation at the same time.
« Reply #1 on: October 11, 2015, 03:20:09 AM »
Hi Alessio,

Sorry for being late, these are crunch days for me.

You would do something like this:
Code: [Select]
// Assuming you have two arrays "posArray" and "rotArray", one for positions and one for rotations
Sequence s = DOTween.Sequence();
for (int i = 0; i < posArray.Length; ++i) {
   Vector3 toPos = posArray[i];
   Vector3 toRot = rotArray[i];
   s.Append(myTransform.DOMove(toPos, duration));
   s.Join(myTransform.DORotate(toRot, duration));
}

Cheers,
Daniele