alana1275 Riddler Posted February 15, 2012 Share Posted February 15, 2012 Hi everyoneI'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 More sharing options...
Rolig Loon Posted February 15, 2012 Share Posted February 15, 2012 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); 1 Link to comment Share on other sites More sharing options...
Lucinda Bulloch Posted February 16, 2012 Share Posted February 16, 2012 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. 1 Link to comment Share on other sites More sharing options...
alana1275 Riddler Posted February 16, 2012 Author Share Posted February 16, 2012 Thank you for your help, yea I saw llEuler2Rot() on the lslwiki but wasn't sure of its application. But tried as you suggested, worked out the correction to the rezzed orientation and it worked:))) Link to comment Share on other sites More sharing options...
alana1275 Riddler Posted February 16, 2012 Author Share Posted February 16, 2012 Hi, yes its made up of several sculpts. Thank you for explanation - mades it a lot clearer why it was doing it. Link to comment Share on other sites More sharing options...
Recommended Posts
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