Jump to content

help with gun script please


alana1275 Riddler
 Share

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

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

Recommended Posts

Hi everyone

I'm still fairly new to scripting and am having some trouble with this script which fires gun bullets.   It works all fine apart from  when the bullet is rezzed and travels outwards it is at the wrong orientation - instead travelling head first,  its travelling sideways first.

I'm sure this is to do with llGetRot();  returning the wrong values - the object is getting rezzed in the wrong orientation with respect to it's container.   Anyways,  I've searched and looked up the first of the four functions in the script and understand them better but just had no luck at all getting the bullets to fire out correctly.

Here is the part of the script that is having trouble:

 

vector  gEyeOffset = <0.0, 0.0, 0.84>;

integer velocity=40;

f()

    {

vector my_pos = llGetPos() + gEyeOffset;

rotation my_rot = llGetRot();

vector my_fwd = llRot2Fwd(my_rot);

llRezObject("Bullet", my_pos, my_fwd * velocity,my_rot,1);

 

}

 Any help appreciated

 

Thanks



Link to comment
Share on other sites

Without really knowing what the "correct"orientation is supposed to be, all I can do is guess.  Tha answer, however, is to just add an appropriate rotation to the one you are applying to the bullet on rez.  If you want to turn it 90 degrees, for example ...

llRezObject("Bullet", my_pos, my_fwd * velocity,llEuler2Rot(<0.0,0.0,PI/2>)*my_rot,1);

  • Like 1
Link to comment
Share on other sites

Is the bullet a sculpt, if so then its the bullet not the script, that script rezzes a object with its x face in front, but if you bullet has been made with the y face in front then it will travel side ways, you can get round this by adding a prim, making that the root and with its x in the same direction as the bullet front, that what I do when ever I use sculpty bullets or weapons.

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4424 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...