Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Rezzing an object from an attachment (like a gun)

Maya Remblai
The one with pink hair.
Join date: 25 Mar 2006
Posts: 434
07-10-2008 06:12
I have an attachment that's supposed to rez an object in front of the avatar and move away in a straight line, but it usually shoots the object off the the side instead of straight ahead. This is supposed to be used *without* mouselook by the way. Any advice?

default
{

touch_start(integer total_number)
{
float speed = 10;
rotation rot = llGetRot();
vector vel = llRot2Fwd(rot);
vector pos = llGetPos();
llRezObject("Bullet",pos, vel * speed, rot, 0);
}
}
Jolly Jedburgh
Hoof Hearted?
Join date: 18 Mar 2006
Posts: 58
07-10-2008 15:08
Are you sure your attachment's x axis is pointing to the front of the avatar?
Nexii Malthus
[Cubitar]Mothership
Join date: 24 Apr 2006
Posts: 400
07-10-2008 15:14
Are you using the llGetRot in a child prim of the attachment? If so, use llGetRootRotation instead.
_____________________

Geometric Library, for all your 3D maths needs.
https://wiki.secondlife.com/wiki/Geometric

Creator of the Vertical Life Client
Maya Remblai
The one with pink hair.
Join date: 25 Mar 2006
Posts: 434
07-10-2008 17:23
1) I don't remember, just that the object has a zeroed rotation. It's not shooting out the side, it's going forward, but crooked (does that make sense)?

2) It's a root prim.