mrdoob/three.js — Issue #807: Best way to store animation data for efficient playback?
Author: Jakobud
Created: 2011-11-28 02:53:20+00:00
State: open

Lets say I have 10 objects in a scene that have predetermined animation data, perhaps loaded from some file. Each object has tx, ty, tz, rx, ry, rz (and maybe scale as well?) animation data for each frame. Lets say I have 100 frames of animation.

What is the best way to store the animation data of the objects so that it's most efficient for three.js to playback the animation? I don't know if its best to just have everything in a nested array of arrays or what... Need to simply iterate through the animation frames and then access set the translate and rotation data for each object for each frame.

Something like...

```var data = { "frame" : 0, "anim" : { "object1" : { "tx" : 4.345, "ty" : 5.678, (etc) }, "object2" : { "tx" : 10.345, (etc) } } };```

Or maybe better to have one individual array for each object? I dunno. Just trying to find what is most efficient for Javascript and three.js to handle. I want to potentially feed in a LOT of predetermined animation data so it needs to be efficient.

Another question: does three.js already have a system or methodology in place for this?