managed to attach the sprite to the desired vertex, and i get the angle (had to correct it gith -90, as you said grimber).
however the sprite's centre is attached to the vertex, but I need the middle of the left edge to be attached.. help me please.
Code:
//entities
entity* podL;
entity* podR;
entity* lightning;
//vars and vecs
var vec_pos1[3]; //left pod
var vec_pos2[3]; //right pod
var vec_direction[3]; //from left to right
var lightangle[3];
var dist;
//actions
action pod1{
podL=my;
my.material=poddy;
my.transparent=off;
}
action pod2{
podR=my;
my.material=poddy;
my.transparent=off;
}
action sprite{
proc_late();
lightning=my;
my.bright=on;
while(1){
my.frame += 2*TIME_STEP;
my.frame %= 55;
vec_for_vertex (vec_pos1,podL,1220);
vec_for_vertex (vec_pos2,podR,1219);
dist=vec_dist (vec_pos1, vec_pos2);
vec_set (vec_direction, vec_pos1);
vec_sub (vec_direction, vec_pos2);
vec_to_angle (lightangle, vec_direction);
my.x = vec_pos1.x; //--->what to add here?<---
my.y = vec_pos1.y;
my.z = vec_pos1.z;
my.pan=(lightangle.pan +90);
my.tilt=lightangle.tilt;
my.roll=-lightangle.tilt;
wait(1);
}
}
PS: the angle values just work as posted, dunno why it is that way...