Jump to content

Rezzing stuff from child prims in attachments


Innula Zenovka
 Share

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

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

Recommended Posts

Am I correct in thinking that, if I want to rez something from a child prim in an attachment and I want to do it all from the child prim, I calculate the offset based on 

 llGetPos()+llGetLocalPos()+offset

 That is, where I am, plus where the prim is, plus the offset?

And, if I am, do I multiply the lot by the child prim's PRIM_ROT_LOCAL or do I do something like

(llGetPos()+llGetLocalPos()*llGetRot())+offset*llList2Rot(llGetLinkPrimitiveParams(LINK_THIS,[PRIM_ROT_LOCAL]),0)

 I'm getting very confused. 

I'm going to be seated when I rez stuff, and the attachment attaches to my pelvis, so I'm not too worried about animations messing me up.

Link to comment
Share on other sites

Hi, I will need to hammer on the llGetPos() documentation a little more, I tried to use the pelvis as a familiar point of reference but that is not really accurate either.

The real reference location is the avatar's root position. This can be seen with Develop>Avatar>Display Agent Target.

If the avatar is standing/flying/ground sitting, this location is the red cross hairs. This is usually a little bit little below the pelvis when standing or flying, near the head on ground sit. If the avatar is sitting on an object, it is the off-white cross hairs, by default about collar height and over the thigh.  [ The red and white are both usually present, the one we can see is an artefect of their draw order. The visible one could change if that part of the viewer code is touched. ]

There is a proposal for a "root" attachment point that matches this position, but since we don't have one it is virtually impossible to get a perfect match for an attachment prim's location. So, we can usually get a good value for Y, but X and Z will usually be a little off. Another complication is that outside mouselook, the avatar's rotation on the server will not perfectly match what is on screen.

If we put away the idea of a perfect match to the attachment, and worry only about the avatar postition --

- From a child prim, llGetPos() - (llGetLocalPos() * llGetRootRotation()) will match llGetRootPosition().

- From the child prim again, llGetPos() - (llGetLocalPos() * llGetRot()) will match the distance to the root, but offset it by the child prim's rotation relative to the root (that is, relative to the avatar's nominal rotation plus child rotation).

Is that enough to work on?

 

 

Link to comment
Share on other sites

Thank you so much for that clarification, Cerise.   I'm not sure yet if it solves my problem, but it certainly explains persistent apparent inaccuracies in my testing, which were a major reason for my confusion.

I'm working on a tank turret for someone, which the gunner wears.   I've got the turret and the barrel moving independently without too much difficulty, but my headache is calculating exactly where the barrrel ends up pointing when I come to fire stuff, and then rezzing it in the right place and moving in the right direction.

I'm wondering if I'm going at it the wrong way, and if it wouldn't be simpler to rez my missiles from the prim on which the avatar is seated, since at least there's no doubt about where that is, though I'd still have the problem of knowing exactly where the barrel prim in the attachment is pointing.    I know how I've told it to rotate, of course, but since it's attached to an avatar sitting on the prim, I don't know exactly where it is in space, I don't think.

Link to comment
Share on other sites

I think you might know where it is in space, if you are providing a sit animation. At least the X and Y should be close enough, the Z might be a little off but a fixed offset fudge plus a little particle flash can hide little errors. You could get close to perfect if you could force the rider to wear a special shape, but that could be asking too much.

If the main object knows the desired rotation then yes, it is probably fine to rez from there.  You already know the size and base alignment for the turret prims, and there are other ways to get the avatar's position, so the child prim really has nothing new to tell you.

I want to say that the attachment position stuff really is useless, but then the function looks up with sad eyes and says "please don't abandon me!"

Link to comment
Share on other sites

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