Tried that before I posted here, doesn't work. 2 things: If I calculate the angle difference and the target is not in the plane that is defined by the ship's ( == the moving entitie's) origin and the ship's direction as a normal vector, then the angle is greater than the roll angle I'd need to set.
So instead, I projected the vector from the ship to the target into the plane that I just mentioned and then set the roll to the angle difference between the entitie's local z axis and the vector to the target (in the plane):
http://www4.picfront.org/picture/NzvzJ7CY/img/vecs4Eva.jpgthe red vector is the projected vector, the dotted orange-ish vector is the vector to the target.
Problem now is that I use:
vec_diff(temp,my.x,myFrontTarget.x);
vec_to_angle(my.pan,temp);
and then, after calculating the angle difference to myTopTarget:
my.roll += angleDifference;
Now, for some reason, when i do this once a frame, the entity's keep on "jumping" around.
Thanks for the suggestion!
edit: I think my calculation for the roll angle may have been wrong. So maybe this method works after all. I'll keep trying, but I'm still open for other methods.
edit2: solved. The problem was that I forgot that the angle between the two vectors was always positive. so when adding that to the roll angle I need to change the sign if the target is below the entity.