Jump to content

How to get the rotation of the root prim of an attachment?


Quistess Alpha
 Share

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

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

Recommended Posts

//From inside an attachment:
rotation X = ???;
llOwnerSay((string)(llEuler2Rot(X)*RAD_TO_DEG)); 
// expect the x,y,z values of the orientation of the attachment as seen in the build window.

// things that should work :
    llList2Rot(llGetLinkPrimitiveParams(LINK_ROOT,[PRIM_ROT_LOCAL]),0); // I originally thought it didn't, see below.
    llGetLocalRot(); // only when called from the root.
// things that don't work because they return the /avatar/'s rotation.
    llGetRot();
    llGetRootRotation();
    llList2Rot(llGetObjectDetails(llGetLinkKey(1),[OBJECT_ROT]),0);

There are ways to get around it for what I want to do if I really need to, but is there seriously no way to fetch the rotation of an attachment, or am I just too tired?

The wiki is my friend if I read close enough. The answer is llGetLocalRot but only if the script is in the root prim. Ammend my question to ask: Is there no way to get the rotation of the root from a child prim of an attachment? (Answer: yes, llList2Rot(llGetLinkPrimitiveParams(LINK_ROOT,[PRIM_ROT_LOCAL]),0); )

Edited by Quistess Alpha
Link to comment
Share on other sites

The real problem is that the rotation of the root prim of an attachment is taken to be the avatar's own rotation. I think the system designers made it that way so that "forward" for an attachment is always the same as "forward" for the avatar. If that weren't so, we'd have a heck of a time with HUDs, attached sensors, and all sorts of other things that have to follow the movement of the avatar. The local rotations of child prims are fine, because they take their cue about where "forward" is from the root prim.

  • Like 1
Link to comment
Share on other sites

1 hour ago, Quistess Alpha said:
//From inside an attachment:
rotation X = ???;
llOwnerSay((string)(llEuler2Rot(X)*RAD_TO_DEG)); 
// expect the x,y,z values of the orientation of the attachment as seen in the build window.

// things that don't work because they return the /avatar/'s rotation.
llList2Rot(llGetLinkPrimitiveParams(LINK_ROOT,[PRIM_ROT_LOCAL]),0);
llGetRot();
llGetRootRotation();
llList2Rot(llGetObjectDetails(llGetLinkKey(1),[OBJECT_ROT]),0); // WTF, I really thought this one would work.

There are ways to get around it for what I want to do if I really need to, but is there seriously no way to fetch the rotation of an attachment, or am I just too tired?

The wiki is my friend if I read close enough. The answer is llGetLocalRot but only if the script is in the root prim. Ammend my question to ask: Is there no way to get the rotation of the root from a child prim of an attachment?

I do NOT see llGetLinkPrimitiveParams(1,[PRIM_ROT_LOCAL]) returning the owner's rotation when called from a root or child link.

I do see llGetLinkPrimitiveParams(1,[PRIM_ROTATION]) returning the owner's rotation when called from a root or child link, though.

  • Thanks 1
Link to comment
Share on other sites

38 minutes ago, Lucia Nightfire said:

I do NOT see llGetLinkPrimitiveParams(1,[PRIM_ROT_LOCAL]) returning the owner's rotation when called from a root or child link.

Ahh, you're right, in my frustration and "throwing everything at the wall to see what sticks" I must have overlooked some subtle other error in my code when I tried that case.

Another reminder that one really does need to create a minimal example for these sorts of things rather than just throwing variations into a complicated script and hope one of them "does the right thing". . . Even if making a new script to test basic features is annoying and tedious. . .

Retroactively edited the OP.

  • Haha 1
Link to comment
Share on other sites

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