Hi

Here is a sample code for this :-

Code:
  
//v_little = vertex number of little finger
//v_index = vertex number of index finger
//--------------------------------------------------
function vertex_attach_weapon(v_little,v_index)
{
var vec_little;
var vec_index;
var vec_dir;

//calculate world vectors of the 2 points
vec_for_vertex(vec_little,player_ent,v_little);
vec_for_vertex(vec_index,player_ent,v_index);

//calculate direction vector between the 2 points
vec_diff(vec_dir,vec_index,vec_little);

//calculate angle of the hand vector
vec_to_angle(temp,vec_dir);
temp.roll = 0;

//orient weapon to that angle
vec_set(my.pan,nullvector);
ang_add(my.pan,temp.pan);

//position weapon to half length within grasp
vec_scale(vec_dir,0.5);
my.x = vec_little.x + vec_dir.x;
my.y = vec_little.y + vec_dir.y;
my.z = vec_little.z + vec_dir.z;
}
//-----



You have to call it in the weapons code every frame.
Hope it helps.

zazang


I like good 'views' because they have no 'strings' attached..