3D Animation

There are many ways to aproach animation in 3d. Here is one way.

vec_reset
d3d_transform_set_identity;

vec_add
d3d_transform_add_translation(argument0, argument1, argument2);

vec_rotate
d3d_transform_add_rotation_x(argument0); d3d_transform_add_rotation_y(argument1); d3d_transform_add_rotation_z(argument2);

vec_scale
d3d_transform_add_scaling(argument0, argument1, argument2);

At this point you may say "Hey! You're just re-captioning transform scripts?". Yes. This makes it several times less confusing (You can switch back to d3d_transform_ scripts later, if you want to)

Stacking transformations
d3d_transform's are applied in the order of function call. For most of cases (and the skeleton case), you should use the following structure for each transformation level:
 * {scaling} {rotation} {translation}

So that the object is scaled, then rotated, and then re-positioned.

Building basic skeleton
0.Storing angles. To store angles efficiently, you will need 3 arrays (x rotation, y rotation, z rotation). Do not forget to initialise these at creation event of object that will be drawing skeleton. 1.First skeleton 'level'. First skeleton level is 'base bone' of model. All other bones are supposed to be attached to it.

vec_reset;//reset transformation variables  vec_rotate(ax, ay, az);vec_add(ox, oy, oz);//ax,ay,az - rotation variables; ox,oy,oz - global translation (likely x,y,z)  '''d3d_draw_block(-10,-10,0,10,10,40,tex,1,1);//draw the bone around the axis2. Second skeleton 'level'.'''

Since the bone #2 is supposed to be attached to bone #1, we need to transform it properly.

'''vec_reset;//again, don't forget to reset transform variables, or strange things may happen.  vec_rotate(ax[1], ay[1], az[1]);vec_add(0, 0, 40);//second level bone transformations. (0,0,40) is position, relative to first bone ''' '''vec_rotate(ax, ay, az);vec_add(ox, oy, oz);//copy the code from first level transformations.  d3d_draw_block(-8,-8,0,8,8,44,tex,1,1);//draw the bone #22. Further levels.'''

For each level, you need to add transformations after the vec_reset, and before other transformations.

Entire code
vec_reset;//body1 vec_rotate(ax,ay,az); vec_add(ox,oy,oz); d3d_draw_block(-10,-10,0,10,10,40,tex,1,1);

vec_reset;//body2 vec_rotate(ax[1],ay[1],az[1]); vec_add(0,0,40); vec_rotate(ax,ay,az); vec_add(ox,oy,oz);

d3d_draw_block(-8,-8,0,8,8,44,tex,1,1); vec_reset;//body3 vec_rotate(ax[2],ay[2],az[2]); vec_add(0,0,44); vec_rotate(ax[1],ay[1],az[1]); vec_add(0,0,40); vec_rotate(ax,ay,az); vec_add(ox,oy,oz);

d3d_draw_block(-6,-6,0,6,6,48,tex,1,1); vec_reset;//body4 vec_rotate(ax[3],ay[3],az[3]); vec_add(0,0,48); vec_rotate(ax[2],ay[2],az[2]); vec_add(0,0,44); vec_rotate(ax[1],ay[1],az[1]); vec_add(0,0,40); vec_rotate(ax,ay,az); vec_add(ox,oy,oz); d3d_draw_block(-4,-4,0,4,4,52,tex,1,1); By manipulating vec_add's, you change the pivot points on bones.

To achieve animation, you will need a two-dimensional array complex (ax,ay,az[frame,angle]), so you can interpolate angles between two array values, using codes similar to

ax[1] = dax[frame,1] + (dax[frame+1,1] - dax[frame,1]) * (frame - floor(frame));