Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

rezing bullet issue

Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
06-05-2008 15:16
this one gun i scripted i think i screwed up slightly, i cant seam to be able to get the bullet to rotate horizontal it will fire out verticly and well.... ya... lol scripts dont seam to like me today

CODE

f()
{
vector b = llGetPos();
rotation a = llGetRot();
vector c = llRot2Fwd(a);
vector d = llRot2Up(a);
b += c;
b += d * 1;
c *= 70;
llRezObject("Bullet", b, c, <0,0,0,0>, 0);
}
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
06-05-2008 17:16
is it in an attachment or a rezzed prim shooting, its possible the root prim of the "gun" is not rotated to face x forward in the direction of the gun or something like that. Ie if I rez a popgun on the ground, it often doesn't shoot forward the way it would if it was attached to my avatar.
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
06-05-2008 18:44
attachment
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
06-05-2008 19:40
Generic way to shoot anything from an attachment, assuming you're in mouselook:

string bullet = "Object"; // insert name here or something
rotation rot = llGetRot();
float offset = 1.5; // how many meters away from the avatar's center the bullet will actually rez
float speed = 20.0; // bullet speed

llRezAtRoot(bullet, llGetPos() + <offset, 0.0, 0.0> * rot, llRot2Fwd(rot) * speed; rot; 1);

This will also orient the projectile's x-axis in the direction you are facing.
_____________________