Jump to content

Reverse engineering a pos-rot correctly


Beowulf Zessinthal
 Share

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

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

Recommended Posts

Have to reply just because Gerbils are the second centre of the Universe (after cats of course) but as an attachment.. not sure if av as surrogate root prim does have an easy answer.

Position I think would be simply reverse of Gerbil local pos? Rotations I leave to those I hold in awe who eat quats as snacks.

Link to comment
Share on other sites

Yeah, there's nothing tricky here, except to realize that an attachment can only be positioned relative to its attachment point; there's no way to know where the avatar center is relative to that attachment point at any instant (which changes viewer-side as the avatar skeleton animates). But I'm not sure what's actually being asked here.

Link to comment
Share on other sites

it sure is a puzzle!

heres a diagram that exposes the trickyness of it..

(assume the gerbil is attached to avatar center so the pos rot is a constant knowable in theory)

I know SL has a few very tricky math functions and am posting this in case its somehow 'easy' (!)

..otherwise i will just have to reconfigure my own approach the thing im trying to solve^^

Happy Days! :D



Link to comment
Share on other sites

Ok .. if you like to do the problem thats ok .. but i personally have to back out of this rabbit hole!

My brain can no longer follow it well enough to implement anything useful (!) .. so i need to wipe my brain slate, and solve my design in a different way ..  while avoiding this particular route!  .. ok.. thx for indulging tho!

Link to comment
Share on other sites

The graphic confuses me -- I just cannot figure out what you're trying to do, and it now appears you've moved on to a different approach (which may be wise anyway, depending on the actual underlying objective).

But for completeness, there's no mystery in the numbers shown in that graphic. Below is a little script that generates those numbers, as expected. 

vector CHILD_POS = <0.13972, -0.25801, 0.79175>;rotation CHILD_ROT = <-0.26105, -0.46572, -0.22815, 0.81419>;default{    state_entry()    {        /*        // In root of 2-prim linkset, replicate the orientation in the graphic        llSetLinkPrimitiveParams(2,             [ PRIM_POS_LOCAL, CHILD_POS            , PRIM_ROT_LOCAL, CHILD_ROT            ]);        */        rotation inverseChildRot = ZERO_ROTATION / CHILD_ROT;        llOwnerSay("\nInverse Pos = "+(string)(ZERO_VECTOR - (CHILD_POS * inverseChildRot))            +"\nInverse Rot = "+(string)inverseChildRot);    }}

Now I'm the worst possible choice for explaining stuff, but hopefully that script will help.

One inverts a rotation by dividing the ZERO_ROTATION by it. ("Dividing" is short-hand for "applying the '/' operator; one must never assume that all properties of those operators apply to quaternions as they do to real numbers.)

And because you're switching to the child's coordinate system, you'll need to express the root's position by inverting (subtracting from ZERO_VECTOR) that child's offset from the root rotated by that inverted rotation.

I'm pretty sure this all helps not one whit, so just attribute this post to a spell of OCD.

Link to comment
Share on other sites

You have it! Thanks!

.. you and your ilk are amazing to have around.

I know partially some of the things you described, but trying to keep it in my head and derive the correct permutation of the formula was too much for me!

OK .. thanks so much Qie Dirac (!) .. the inverse calc is correct, now i will see if it can sort out my problem (!)

Link to comment
Share on other sites

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...