White Dragon
New member
O Ilusionista said:This is just awesome! There is a bit of Bezier Curve on it, right?
Question: its possible to controle the angle (rotation) of the pieces, so it will always facing the direction the head is moving to?
TNX, Nothing bezier curve =)
I track with a buffer the movements of the 1st sphere. Other spheres (tails) follow the head sphere.
Than you can set different params for the tail as the offset.
You can control he head and the tail will follow the head as you want!!
If you want control a piece of tail, you can hanle it with all methods.
Example:
If the head entity is void HEAD = getlocalvar(self");
And you want the 3rd sphere (included head) you need:
every tail part (sphere) has an id that starts from 0
so if the serpentine size == 10 the last tail part has ID == 9
int i = 0, ID = 2;
void CHILD = HEAD;
for (i = 0; i < chain_size__(HEAD); ++i) {
if ( get_chain_id_num__(CHILD) == ID ) break;
else CHILD = get_chain_child__(CHILD);
}
With this loop you get the CHILD with ID == 2 (the 3rd part of the serpentine)
This is an example but better way is:
int ID = 2;
void CHILD = get_chain_child__(HEAD);
while ( CHILD != NULL() ) {
if ( get_chain_id_num__(CHILD) == ID ) break;
else CHILD = get_chain_child__(CHILD);
}
to loop the chain structure as a queue!!