Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

rotations & attachments

Seemok Capalini
Registered User
Join date: 4 May 2007
Posts: 17
12-19-2008 02:56
I've had this issue arise before with particles emitting from childprims of attachments, but after not being able to figure out how to solve it, I worked around it by emitting from the base vehicle instead. (i make high prim vehicles that rez & attach parts). But now that I'm arming the vehicles i'm seeing the same issue arise when rezzing bullets....

appearantly llGetPos/Rot(), llGetLocalPos/Rot() etc. return very different data when the object is attached then when it is rezzed inworld. The result being, in case of the particles ,when emitting from a childprim outside the av's center, (in which case the childprim would rotate around the av as it rotates)the particles would not rotate as such. they would stay in the same spot and only rotate around their own center as if the childprim was rotating independantly of the object.

The bullets are rezzed from the objects root, so they'd start from the right spot and travel in the right direction, but their rotation seemed to be global. in other words they'd only be rotated correctly if the avi was aiming at certain direction.
I hope this makes sense to anyone, it's hard to explain really (it took me 30 minutes to write this post:P)
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
12-19-2008 09:04
I think you need to multiply the objects rotation with the 'to be rezzed' objects offsetvector and rotation to get what you're looking for.
Something like this:

CODE


string NAME = ""; // name of object to be rezzed
vector Offset = <.0, .0, .0>; // position relative to prim with script
vector ROT = <.0,.0,.0>; // rotation of object to be rezzed
rotation rot; // quaternion of rotation

default
{
state_entry()
{
rot = llEuler2Rot(ROT * DEG_TO_RAD); // convert to quaternion
llRezAtRoot(NAME, llGetPos() + (Offset * llGetRot()), ZERO_VECTOR, rot * llGetRot(), 42);
}
}

Seemok Capalini
Registered User
Join date: 4 May 2007
Posts: 17
12-19-2008 12:32
Hmmm that one seems to be missing velocity, the bullet rezzes in the center of the av, without moving. This is my current code btw, maybe that'll help

CODE

Fire()
{
rotation rot = llGetRot();
vector vel = llRot2Fwd(rot);
vector pos = llGetPos();
vel = vel * 50;

llRezAtRoot("Bullet", pos, vel, rot + <0,0,0,.01>, 10);
}
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
12-19-2008 13:43
Ah yes.

Try this:

CODE

llRezObject("Bullet", pos + (<.0,.0,.0> * rot), vel, rot + <0,0,0,.01>, 10);