I have an attachment that needs to rez and move a projectile behind an avatar. I've looked at gun scripts (which all rez/move the projectile in front of an avatar, as you would expect) and they use llGetRot to get the direction the avatar's facing and then use llRot2Up to get the vector representing a straight line away from the avatar.
I've tried tweaking the results of these functions to sort of get the opposite position and vector (for example, multiplying x, y, and z of the Rotation by -1 before passing to llRot2Up), but my results have been very bizarre. For example, if I calculate the inverse of the forward vector, my attachment correctly fires the projectile behind me if I'm facing North or South, but fires it in front of me if I'm facing East or West!
What is the proper method for determining a rezzing offset that would position an item behind the avatar, and a vertex that would move the object in that direction? Keep in mind this is for an attachment, so the functions for getting position/rotation work a little differently for standalone objects, to my understanding.
For extra credit, does the local rotation of the attachment mean anything at all? In my tests I've noticed that the projectile doesn't move on a flat plane. The thing will fire higher and further if I'm facing in one direction than it will in another direction, as if its movement plane is tilted down... rotating the attachment doesn't appear to have an effect on this, but I can't tell for sure.