Jump to content

How to rotate a chid prim relative to another child?


Poltergeist Azarov
 Share

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

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

Recommended Posts

Depending on exactly what you are planning to do, that can be challenging computationally.  Essentially, what you need to do is daisy-chain the rotation of Child #1 relative to the root and then calculate Child #2 relative to Child #1, as in

llSetLocalRot (NewRot * LRot1 * llGetRot());

where NewRot is your proposed rotation .... Say llEuler2Rot(<0.0,0.0,10.0*DEG_TO_RAD>)

and you get LRot1 from

llGetLinkPrimitiveParams(2,[PRIM_ROT_LOCAL])

It gets complicated and slow when you are changing all rotations in a time step, so you need to adjust the root, then adjust LRot1 as necessary, and then NewRot.

 EDIT:  If your script is not in Child #2, then you want to use SLPPF to set PRIM_ROT_LOCAL instead of using llSetLocalRot

Link to comment
Share on other sites

Thanks, I am gonna take a look at that. How to calculate also relative pos? (by keeping the original distance between these two prims)

I actually made something but it doesnt keep the original distance between two prims. Just moves 3. prim 3 meters away and faces it on a flat line:

    touch_start(integer total_number)    {            rotation MiddleRot=llList2Rot(llGetLinkPrimitiveParams(2,[PRIM_ROTATION]),0);            vector   MiddlePos=llList2Vector(llGetLinkPrimitiveParams(2,[PRIM_POS_LOCAL]),0);            llSetLinkPrimitiveParamsFast(3,[PRIM_POS_LOCAL,MiddlePos+ llRot2Up(MiddleRot) * 3,                                            PRIM_ROT_LOCAL,MiddleRot]);    }

 Works by 3 linked prims and considers 2. prim as relative point for 3. prim.

Link to comment
Share on other sites

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