How makevectors works, really?
Posted: Wed Aug 06, 2014 9:10 pm
Hy guys, I'm reading a CSQC code that bend skeletal spine bone depending on mouse input:
Now, I'm just not understanding how it works.
From the manual, makevectors is described in this way:Ok, cool.
...uh?! I mean, what global vars? Linked to which entity? The player, A player, an enemy, a bone (in this case)?
It would have been simpler to me to grasp if it was something like that:
In this case, I trap return values of makevector function in a vector and I use that vector to do my stuff...
But I really don't understand how is that possible that calling makevectors(angle) it make the result values petrified in global vars...and HOW these global vars are "reset" after makevectors function has been called?!
EDIT: I put in the QC section because this wasn't meant to be a CSQC topic (the CSQC code above is just an example)
Code: Select all
local vector ang, body_ang;
body_ang = skel_get_bonerel (self.skeletonindex, 1);
ang = '180 0 0';
ang_y = self.bodyangle_y * 0.5;
makevectors(ang);
skel_set_bone(self.skeletonindex, 1, body_ang);
//spine bone
ang = '0 0 0';
ang_y = self.bodyangle_y * 0.25;
ang_z = -input_angles_x * 0.5; // let's divide it.
self.angles_y = input_angles_y+90;
makevectors(ang);
From the manual, makevectors is described in this way:
Code: Select all
Calculate the vectors pointing forward, right and up, according to the provided angles.Code: Select all
Returns result in the global variables:
vector v_forward; // points forward
vector v_up; // points up
vector v_right; // points toward the rightIt would have been simpler to me to grasp if it was something like that:
Code: Select all
local vector newvector;
newvector = makevectors(boneSpine.angles);
print("The angle of Spine is "+ vtos(newvector));
But I really don't understand how is that possible that calling makevectors(angle) it make the result values petrified in global vars...and HOW these global vars are "reset" after makevectors function has been called?!
EDIT: I put in the QC section because this wasn't meant to be a CSQC topic (the CSQC code above is just an example)