Firstly, some screenshots to illustrate my current setup:
This is a mesh from video game Unreal Tournament '99. The mesh has 148 frames which make up a total of 16 different animation sequences.
One of these sequences is a “Grab” animation which consists of 20 frames; here are the first three:
As you can see, I’ve managed to draw each frame as an individual scene; I would like, however, to input all 20 frames into one scene and have Three animate them.
The root of my problem is that I am reading the mesh data manually from the game file at the byte level, as opposed to a file exported from Blender, for example.
Obviously this means I cannot use the model loaders provided by Three and thus have to manually create the animation myself.
After reading the documentation and looking at many examples, it sounds like using keyframe tracks to move between morphTargets would be the most suitable approach; however, I’m finding it frustratingly difficult to find a clear example of how this can be done manually.
The mesh data I have looks like the following:
const frames = [
// Frame 0
[
new THREE.Vector3(vertex1.x, vertex1.z, vertex1.y),
new THREE.Vector3(vertex2.x, vertex2.z, vertex2.y),
new THREE.Vector3(vertex3.x, vertex3.z, vertex3.y),
// etc.
],
// Frame 2
[
new THREE.Vector3(vertex1.x, vertex1.z, vertex1.y),
new THREE.Vector3(vertex2.x, vertex2.z, vertex2.y),
new THREE.Vector3(vertex3.x, vertex3.z, vertex3.y),
// etc.
],
// etc.
];
Can anyone advise on the best way to create an animation clip from this data structure?
Thank you.