Jump to content

Weapons firing a distance away from avatar.


Loki Eliot
 Share

You are about to reply to a thread that has been inactive for 4676 days.

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;
        llRezObject("brawl", pos, vel, rot, LIFETIME);
}

 

Link to comment
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.

 

Link to comment
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.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4676 days.

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...