Is it possible to generate a Path from iTween?

I’m curious if it is possible to generate a Vector3 of path points from an iTween without having to actually run the tween in game to first “gather” the points"?

For example, if I have a gameObject animate and rotate from one position to another, can I get a path of points in Vector3 format (positional and rotational) that would represent that objects path through space?

It is not possible to gather the position/rotation points without running the iTween. Some things you can do:

  • You can run the iTween without the game object visible, and possibility at a much higher rate of speed and collect the data.
  • For simple movements (linear movement without easing, linear rotation without easing), writing code to capture a similar path/rotation is not too difficult.
  • It is possible to run the game in the editor and capture the information, copy the game object at the end of the run (while the game is still running), and then past the game object after stopping the editor. If the array is public, your pasted object will have the captured data.
  • You can capture the data during an editor run and write it out to somewhere permanent. Then use the captured data.

For reference, here is how to capture a basic linear path between 2 objects and store the position and rotation in separate Vector3's.

int pathResolution = 100;  //how many points you want in your path
Vector3[] pathPosition = new Vector3[pathResolution];
Vector3[] pathRotation = new Vector3[pathResolution];
		
float distanceBetween = Vector3.Distance(startPosition, endPosition);
Vector3 deltaPositionVector = endPosition - startPosition;
Vector3 deltaRotationVector = endRotation - startRotation;
		
//generate path points
for(int i = 0; i < pathResolution; i++){
    pathPosition _= startPosition + (deltaPositionVector.normalized * (distanceBetween * i/pathResolution));_

pathRotation = startRotation + (deltaRotationVector * i/pathResolution);
}