Jump to content

LSL rotate object around root center


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

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

Recommended Posts

I have two legs i want to rotate around the hip in opposite directions +10 and -10, if i connect each one to a root prim and rotate using llSetRot it works, but if the body is turned at a different angle than 0 the legs do not move in sync, they literally go x+10/-10. I've tried llSetLinkPrimitiveParams() as well and it does not appear to rotate around the hip. Any tips much appreciated.

 

    listen(integer channel, string name, key id, string message)
    {
        if (message=="step")
        {
            rotation r = llGetRot();
            vector rotationAngle = <angle, 0, 0>;
            vector angles_in_radians = rotationAngle * DEG_TO_RAD; 
            rotation rot = llEuler2Rot(angles_in_radians);
            llSetRot(r*rot);
            angle = -1 * angle;
            llSetRot(r);
        }
    }
 

In the screenshot, the legs on the left "work", if the assembly is turned though, the rotation isn't correct, it's doing a heel click instead. 

the plywood squares are there for the hip center point. 

 

 

 

eb81e439e399b31fb9cc832c0b6d2561.jpg

  • Like 1
Link to comment
Share on other sites

31 minutes ago, Khadijah Starchild said:

llSetRot(r*rot);

you probably want rot*r instead, to rotate with respect to the intrinsic axes of the legs, rather than the intrinsic axes of the body? it's hard to say much specific without testing in-world or knowing the intrinsic axes of all the parts.

33 minutes ago, Khadijah Starchild said:

vector rotationAngle = <angle, 0, 0>;
            vector angles_in_radians = rotationAngle * DEG_TO_RAD; 
            rotation rot = llEuler2Rot(angles_in_radians);

It might be more clear to use:

rotation rot = llAxisAngle2Rot(<1,0,0>, angle*DEG_TO_RAD);

instead.

  • Like 1
  • Thanks 2
Link to comment
Share on other sites

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