I've been trying to make myself a multi-prim door which will rotate properly around its local Z axis, regardless of any X or Y rotations (think of angled doors).
I've done this with child prims, no matter what the rotation of X and Y the local Z rotation works perfectly and the object spins around its local axis, but when I try rotating a whole object...... it will not do a local rotation around the parent Z axis and always seems to rotate around the global Z axis instead. This, of course, leads to odd rotations. When the door is upright, it does a perfect hinge rotation, the problem weighs in when the door is "angled" on any arbitrary X or Y axis.
Assume the door is also on a 30 degree angle on the X axis, and this is the rotation to do the Z rotation.
float fn_fRotation = 45;
rotation fnRotateZ;
rotation fnNewRotation;
fnRotateZ = llEuler2Rot( <0, 0, fn_fRotation * DEG_TO_RAD> );
fnNewRotation = llGetRot() * fnRotateZ;
llSetRot( fnNewRotation );
3D math and rotations are from my strong suit, but I've tried a few variations of this, including llGetLocalRot, llSetLocalRot, etc. Nothing seems to have any affect on the rotation and the door will (swing) around the global Z instead of the hinge's local Z.
I know I'm missing something simple, but I don't know what.
