Here is my situation. I have a child prim with this script in it. I also have a variable called target_offset, which specifies the coordinate that I want the prim to rotate around, in the coordinate system of _the child prim_. Not the world's CS nor the CS defined by the root of the object, but the prim's own CS.
Is this the right way to give the object a nudge on the *local* (root-based) X-axis, around the *primlocal* (child-prim's-center-based) location target_offset? It seems to produce some form of rotation but it doesn't look like it's getting the point correct.
setPosRot(vector pos, rotation rot) {
llSetPrimitiveParams([PRIM_POSITION,pos,PRIM_ROTATION,rot / llGetRootRotation()]);
}
....
touch_start(integer total_number)
{
vector current_offset = (target_offset * llGetRootRotation()) * llGetLocalRot();
rotation new_rotation = llGetLocalRot() * (llEuler2Rot(<PI/8,0,0>
);vector new_offset = (target_offset * llGetRootRotation()) * new_rotation;
vector offset_variance = new_offset - current_offset;
setPosRot(llGetLocalPos() - offset_variance, new_rotation);
}