Jump to content

can pos & rot be reverse engineered?


Beowulf Zessinthal
 Share

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

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

Recommended Posts

My diagram shows a table as root prim, and a person standing at some vector vec and rotation rot offset.

Is it possible to get the same relative result (using the original vec & rot data) when using the person as root?

I know there is quaternion magic, and am hoping something like using "pos*quat/ZERO_ROTATION" can do it?

Thanks for considering this!!!

reverse engineer posrots.jpg

Edited by Beowulf Zessinthal
Link to comment
Share on other sites

If you know the world-positions of both, you can get the relative values:

vector relative_pos = avatar_pos - table_pos;
rotation relative_rot = avatar_rot / table_rot;

If you want it the other way around, just swap the values:

vector relative_pos = table_pos - avatar_pos;
rotation relative_rot = table_rot / avatar_rot;

 

But you can also just "flip" the values you already have. Your first guess was close.

vector opposite_pos = relative_pos * -1;
rotation opposite_rot = ZERO_ROTATION / relative_rot;
Edited by Wulfie Reanimator
Link to comment
Share on other sites

What makes the angle at the pointer relative?  I see you can get the angle - or bearing (pink line) - from the table to the person or the person to the table, but I'm not sure how you associate the seemingly arbitrary rotation angle of each individual object based on the other.... unless it's calculated based on the bearing angle between the two objects?

Don't you need another variable such as: child forward is 50% of the angle between green and pink?

Edited by DoteDote Edison
Link to comment
Share on other sites

1 hour ago, DoteDote Edison said:

What makes the angle at the pointer relative?  I see you can get the angle - or bearing (pink line) - from the table to the person or the person to the table, but I'm not sure how you associate the seemingly arbitrary rotation angle of each individual object based on the other.... unless it's calculated based on the bearing angle between the two objects?

Don't you need another variable such as: child forward is 50% of the angle between green and pink?

Sorry DoteDote i dont follow you exactly :(  ..

My thinking is that in order to use the x & y vectors in any 'opposite' way, we have to 'multiply' the quat rotation in there too. 

I dont claim to understand how it works.. but i know quaternions can do these sort of magical things somehow! :)

Link to comment
Share on other sites

9 hours ago, Beowulf Zessinthal said:

Thanks Wulfie, but it didnt quite work for me ?

I have to be using local pos rots only .. and did this:

reverse engineer posrots2.jpg

Ah, small mistake on my part. Here's the fix, using your code as an example:

default
{
    state_entry()
    {
        integer otherLink = 2;
        vector pos = <0.621, -0.235, 0> * -1;
        rotation rot = ZERO_ROTATION / <0, 0, 0.924, 0.383>;

        pos *= rot; // Apply the new rotation to the new position.

        llSetLinkPrimitiveParamsFast(otherLink, [PRIM_POS_LOCAL, pos, PRIM_ROT_LOCAL, rot]);
    }
}

2f0a12a141.png

P.S. I'm sorry that I can't really explain how this works, I just kind of "intuitively know."

Edited by Wulfie Reanimator
  • Like 1
Link to comment
Share on other sites

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