# Weapons firing a distance away from avatar.

Please take a moment to consider if this thread is worth bumping.

## Recommended Posts

Today im working on making a throwing game but im having difficulty with the distance an object rezzes from the avatar.

My avatar wears a chair that he is posed to throw, and when fired the chair rezez a physical chair that hurtles across the room. What i need though is to make it so the physical chair rezzes about 1 metre from the chair im holding so they do not touch.

I have been able to se the physical chair to rez using pos = get pos but when i face my avatar in a different direction i realise it does not related to avatars facing position. Does anyone know what i need to do to get my Physical chair to rez 1 metre infront of my avatar regardless of which direction my avatar is facing?

This is the script i am currently using...

```fire()
{
rot= llGetRot();
vel =llRot2Fwd(rot);
pos = llGetPos();
pos.z +=0;
pos.y +=1.0;
vel = vel*SPEED;
}```

##### Share on other sites

regionPos + localVector * regionRot

llGetPos() + <1.0, 0.0, 0.0> * llGetRot()

you may want to add half the agent size z value to the final value to bring it to eye level of the avatar.

##### Share on other sites

To translate Void's correct answer into imperfect English...

< 1, 0, 0 > is a vector pointing 1 meter in front of an object in the object's coordinates.  Post multiplying by the object's rotation converts to the world coordinates.  Also, it is not multiplication in any matrix sense.  It is just a symbol that is used.

##### Share on other sites

And just for a bit of extra info, The X axis is considered the forward facing axis at zero_rotation. If you've ever heard the tip to to orient your vehicle such that its front faces east (the positive X axis) when the object is at ZERO_ROTATION, that is why.