Im trying to learn bone animation. My designer has chosen the 3d-format, b3d.
If you want to help me with my problem but dont know the b3d-fileformat here is the specifications http://www.zen54709.zen.co.uk/b3dformat.htm#BB3D
So far I know how to make a glCanvas show a frozen non-animated version of my designers models. Now its time that I learn the animation part.
I have been told to read alot about quaternions and transformation matrices. I have also been told to make a tranformation and rotation matrix for each NODE in the model. I have writen a chunkWriter that println’s some info in each chunk to the screen - just to make me more comfortable with the way a b3d-file is build up. It looks more or less like this:
BB3D - 6184 Bytes - version: 1
TEXS - 43 Bytes - TexturePath: .\snowdrag.png - xpos: 0.0 ypos: 0.0 xscale: -0.0 yscale: -8.8E-44 rotation: 8.8E-44
BRUS - 47 Bytes
NODE - 6066 Bytes - Node name: ROOT. Position: (0.0, 0.0, -0.0). Scale: (1.0, 1.0, 1.0). Rotation: (1.0, 0.0, 0.0, -0.0).
MESH - 4372 Bytes - Master brush: -1
VRTS - 2332 Bytes - Flags: 0, 1, 2. 5 floats/vert.(x,y,z,u,v). All vertices writen to Vertices.txt
TRIS - 2020 Bytes - Brush: -1 - Triangles: 168 - All triangles has been writen to Triangles.txt and Pollies.txt
ANIM - 12 Bytes - Flag: 0 - Frames: 30 - Fps: 0.0
NODE - 1613 Bytes - Node name: joint1. Position: (0.04537487, 0.0, -22.83983). Scale: (1.0, 1.0, 1.0). Rotation: (-4.3711385E-8, -4.3711392E-8, 1.0, 4.3711392E-8).
BONE - 520 Bytes. Vertex1: 0 - Weight1: 1.0. Vertex2: 1 - Weight2: 1.0
KEYS - 84 Bytes - Flag: 1 - Frame: 1 - Position: (0.0453749, -0.3333354, -0.0064964294).
KEYS - 104 Bytes - Flag: 4 - Frame: 1 - Rotation: (-6.1817246E-8, -6.181724E-8, 0.70710695, -0.7071066).
NODE - 826 Bytes - Node name: joint2. Position: (0.0, 0.0, -23.25). Scale: (1.0, 1.0, 1.0). Rotation: (-4.3711488E-8, -3.1391647E-7, -3.1391647E-7, -1.0).
BONE - 408 Bytes. Vertex1: 3 - Weight1: 1.0. Vertex2: 4 - Weight2: 1.0
KEYS - 100 Bytes - Flag: 1 - Frame: 1 - Position: (-1.9895195E-13, -1.9895198E-13, -23.25).
KEYS - 124 Bytes - Flag: 4 - Frame: 1 - Rotation: (-4.3711488E-8, -3.1391647E-7, -3.1391647E-7, -1.0).
NODE - 115 Bytes - Node name: joint3. Position: (0.0, 0.0, -22.75). Scale: (1.0, 1.0, 1.0). Rotation: (1.0, 0.0, 0.0, -0.0).
BONE - 0 Bytes.
KEYS - 20 Bytes - Flag: 1 - Frame: 1 - Position: (0.0, 0.0, -22.75).
KEYS - 24 Bytes - Flag: 4 - Frame: 1 - Rotation: (1.0, 0.0, 0.0, 0.0).
I assume that the 4 floats in Rotation in each node is the quaternoin I have to use to make the matrix, is that right?
Also, the quaternion will only give me a 3x3matrix… isnt it a 4x4matrix I have make?
This is where im standing… this whole quaternion/transformation matrix stuff is quite a mouthfull for me!! So I hope someone can tell me what to do next. Each NODE gives also a position(3 floats) and a scale (3 floats). Where do I use them?
heres some math, whatelse do I need to do?
Matrix = [ 1 - 2y2 - 2z2 2xy - 2wz 2xz + 2wy
2xy + 2wz 1 - 2x2 - 2z2 2yz - 2wx
2xz - 2wy 2yz + 2wx 1 - 2x2 - 2y2 ]
given the quaternion Q (w, x, y, z)